Questions tagged [wordpress]
This tag is for programming-specific questions about the WordPress content management system. Off-topic questions include those about theme development, WordPress administration, management best practices, server configuration, etc. These are best asked on the dedicated WordPress Development Stack Exchange site (https://wordpress.stackexchange.com).
174,131
questions
678
votes
20answers
690k views
Create a folder if it doesn't already exist
I've run into a few cases with WordPress installs with Bluehost where I've encountered errors with my WordPress theme because the uploads folder wp-content/uploads was not present.
Apparently the ...
593
votes
33answers
405k views
Can I install/update WordPress plugins without providing FTP access?
I am using WordPress on my live server which only uses SFTP using an SSH key.
I want to install and upgrade plugins, but it appears that you are required to enter your FTP login to install the ...
399
votes
15answers
675k views
Correct file permissions for WordPress [closed]
I've had a look over here but didn't find any details on the best file permissions. I also took a look at some of WordPress's form's questions over here too but anybody that suggests 777 obviously ...
278
votes
17answers
307k views
How can I add a PHP page to WordPress?
I want to create a custom page for my WordPress blog that will execute my PHP code in it, whilst remaining a part of the overall site CSS/theme/design.
The PHP code will make use of third-party APIs (...
263
votes
9answers
232k views
upstream sent too big header while reading response header from upstream
I am getting these kind of errors:
2014/05/24 11:49:06 [error] 8376#0: *54031 upstream sent too big header while reading response header from upstream, client: 107.21.193.210, server: aamjanata.com,...
239
votes
22answers
481k views
PHP Warning: POST Content-Length of 8978294 bytes exceeds the limit of 8388608 bytes in Unknown on line 0
I am getting this error when trying to upload an import on WordPress on my XAMPP local dev environment:
Warning: POST Content-Length of 8978294 bytes exceeds the limit of 8388608 bytes in Unknown on ...
233
votes
16answers
589k views
TypeError: $ is not a function when calling jQuery function
I have a simple jQuery script in a WordPress plugin that is using a jQuery wrapper like this:
$(document).ready(function(){
// jQuery code is in here
});
I am calling this script from within ...
205
votes
6answers
256k views
Table is marked as crashed and should be repaired
I am getting this error in wordpress phpMyadmin
#145 - Table './DB_NAME/wp_posts' is marked as crashed and should be repaired
When I login to phpMyadmin, it says wp_posts is "in use"
My website is ...
193
votes
12answers
324k views
#1273 ā Unknown collation: āutf8mb4_unicode_520_ciā
I have a WordPress website on my local WAMP server. But when I upload its database to live server, I get error
#1273 ā Unknown collation: āutf8mb4_unicode_520_ciā
Any help would be appreciated!
189
votes
14answers
371k views
#1273 - Unknown collation: 'utf8mb4_unicode_ci' cPanel
I have a WordPress database on my local machine that I want to transfer to a hosted phpMyAdmin on cPanel. However, when I try to import the database into the environment, I keep getting this error:
#...
171
votes
4answers
135k views
Best place to insert the Google Analytics code [duplicate]
Whereās the best place to insert the Google Analytics code in WordPress, header or footer? I prefer footer, because I wanted my site to load faster by reducing the number of scripts in the header, but ...
168
votes
19answers
419k views
How can I get the current page name in WordPress?
What PHP code can be used to retrieve the current page name in a WordPress theme?
All the solutions I have seen so far (the_title(), get_page()->post_name, get_post(), etc.) don't work for a page ...
165
votes
26answers
270k views
Nginx serves .php files as downloads, instead of executing them
I am installing a website in a droplet (Digital Ocean). I have a issue for install NGINX with PHP properly. I did a tutorial https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-...
158
votes
16answers
145k views
How do I find out what version of WordPress is running?
I have just taken over someone's hosted WordPress site. How do I find out what version he is running?
152
votes
11answers
209k views
What type of hash does WordPress use?
What type of hash does WordPress use?
Here is an example of a WordPress hash:
$P$Bp.ZDNMM98mGNxCtHSkc1DqdRPXeoR.
150
votes
20answers
402k views
How to get WordPress post featured image URL
I am using this function to get the featured images:
<a href="#" rel="prettyPhoto">
<?php the_post_thumbnail('thumbnail'); ?>
</a>
Now I want to get the full featured image on ...
141
votes
16answers
797k views
Access denied for user 'root@localhost' (using password:NO)
I'm new to MySQL, I'm trying to run WordPress in my Windows desktop and it needs MySQL.
I install everything with Web Platform Installer which is provided by Microsoft. I never set a root password ...
139
votes
14answers
336k views
TypeError: 'undefined' is not a function (evaluating '$(document)')
I'm using a WordPress site.
I'm including this script in the header.
When the script loads, I get this error:
TypeError: 'undefined' is not a function (evaluating '$(document)')
I have no idea ...
132
votes
5answers
63k views
Proper URL forming with Query String and Anchor Hashtag
When both a query string and anchor tag (hash tag) are visible in a URL, what is the proper order for them to appear?
http://www.whatever.com?var=val#anchor
or
http://www.whatever.com#anchor?var=...
129
votes
9answers
231k views
Turn off deprecated errors in PHP 5.3
My server is running PHP 5.3 and my WordPress install is spitting these errors out on me, causing my session_start() to break.
Deprecated: Assigning the return value of new by reference is ...
128
votes
8answers
243k views
How to get the current taxonomy term ID (not the slug) in WordPress?
I've created a taxonomy.php page in my WordPress theme folder. I would like to get the current term id for a function.
How can I get this?
get_query_var('taxonomy') only returns the term slug, I ...
127
votes
18answers
248k views
How do I add a simple jQuery script to WordPress?
I read the Codex and a few blog posts about using jQuery in WordPress, and its very frustrating. I've got as far as loading jQuery in functions.php file, but all of the guides out there are crappy ...
126
votes
4answers
86k views
What does apply_filters(…) actually do in WordPress?
I'm trying to understand some of the function in WordPress, but I can't get my head around what apply_filters(...) actually does.
Is someone able to clear this up for me with a few examples?
125
votes
14answers
103k views
WordPress asking for my FTP credentials to install plugins
I installed a WordPress blog in my local system. But when I try to add plugins from admin it asks for FTP access. What do I need to configure for WordPress to be able to upload without FTP?
123
votes
8answers
127k views
Relative URLs in WordPress
I've always found it frustrating in WordPress that images, files, links, etc. are inserted into WordPress with an absolute URL instead of relative URL. A relative url is much more convenient for ...
119
votes
22answers
224k views
WordPress is giving me 404 page not found for all pages except the homepage
All of a sudden I go to my WordPress website and all the pages give me a 404 page not found page. I'm assuming the problem lies with the permalink structure, which I could swear I did not touch. The ...
114
votes
8answers
104k views
PHP - Merging two arrays into one array (also Remove Duplicates)
Hi I'm Trying to merge two arrays and also want to remove duplicate values from final Array.
Here is my Array 1:
Array
(
[0] => stdClass Object
(
[ID] => 749
[post_author] =...
101
votes
6answers
141k views
How to get last inserted row ID from WordPress database?
My WordPress plugin has a table with a AUTO_INCREMENT primary key field called ID. When a new row is inserted into the table, I'd like to get the ID value of the insertion.
The feature is to using ...
100
votes
3answers
2k views
JointsWP4 (SASS): Changing Properties in Sticky
TL;DR: Is Sticky actually able to react to changes I give through JavaScript? If so, how?
(The project is using Foundation 6.2 and WordPress 4.4, theme installed using Node.js/npm and gulp 4.0. My ...
94
votes
5answers
254k views
How to get WooCommerce order details
In WooCommerce from the following line code:
$order = new WC_Order( $order_id );
How can I get WooCommerce order details from the order id?
94
votes
4answers
21k views
What are the WordPress alternatives for Ruby on Rails? [closed]
What are the WordPress alternatives for Ruby on Rails? How do they compare to WordPress?
89
votes
4answers
127k views
WordPress query single post by slug
For the moment when I want to show a single post without using a loop I use this:
<?php
$post_id = 54;
$queried_post = get_post($post_id);
echo $queried_post->post_title; ?>
The problem is ...
88
votes
1answer
40k views
Strange iframe added into body tags called `rufous-sandbox`
I'm working on a local WordPress site, and for some reason there is an iframe added just after the opening body tag which makes the body to drop down about 20px.
Google only returned 1 relevant ...
80
votes
10answers
119k views
How To Include CSS and jQuery in my WordPress plugin?
How To Include CSS and jQuery in my WordPress plugin ?
78
votes
11answers
283k views
Get current category ID of the active page
Looking to pull the category ID of a specific page in WordPress that is listing all posts using that specific category. Tried the below but not working. I am able to get the category name using ...
78
votes
17answers
169k views
Use .htaccess to redirect HTTP to HTTPs
Please, don't recommend me the long and very detailed thread with more than 173 upvotes. It didn't work for me. I have also tried many others (1, 2, 3, 4). They all give me TOO_MANY_REDIRECTS or error ...
75
votes
9answers
201k views
Get custom product attributes in Woocommerce
In Woocommerce, I am trying to get product custom attribute values but I fail miserably and I don't get anything.
So I tried:
global $woocommerce, $post, $product;
$res = get_post_meta($product->...
75
votes
11answers
104k views
WordPress Get the Page ID outside the loop
I want to get the page ID before starting the loop in WordPress. I am using
$page = get_query_var('page_id');
Apparently, it returns nothing.
I just want to check a page for its ID and add a class ...
72
votes
8answers
224k views
How to pass extra variables in URL with WordPress
I am having trouble trying to pass an extra variable in the url to my WordPress installation.
For example /news?c=123
For some reason, it works only on the website root www.example.com?c=123 but it ...
72
votes
6answers
96k views
How to include WordPress functions in custom .php file?
How can I include WordPress functions in a custom .php file?
In detail: I have a directory under my theme (Constructor) named reports. These contain .php files that generate reports from data from ...
72
votes
5answers
24k views
How to Use AJAX in a WordPress Shortcode?
I have a code to display a random quote. One person wrote a function to implement all of this. But the update data via AJAX for some reason does not work. When you press the button "New Quote", ...
70
votes
4answers
46k views
Where is the post featured image link stored in the WordPress database?
Where is the featured image link stored in the WordPress Database? I searched in the wp_postmeta table but I cannot find out the exact post_id and links.
Is this correct? Could anyone please explain ...
70
votes
8answers
60k views
Local wordpress install only shows home page, all other pages Not Found
I am working on a local install of a live wordpress site, all links from the main page show Not Found errors. all .htaccess files are all present.
The problem is that every page except for the home ...
68
votes
13answers
117k views
wp_nav_menu change sub-menu class name?
Is there a way to change the child <ul class="sub-menu"> generated by WordPress itself to a custom class name?
I know the parent <ul> you can remove or change the name with 'menu_class' =&...
67
votes
5answers
34k views
WordPress 3.5 custom media upload for your theme options
WordPress 3.5 has been released recently, I used the WordPress Media Upload system via thickbox and window.send_to_editor for some options in my WordPress theme (backgrounds, logos etc...).
But as ...
66
votes
10answers
48k views
WordPress: Disable “Add New” on Custom Post Type
Is there any way to disable the option of adding a new post under a Custom Post Type in WordPress (3.0)? I've looked into labels and arguments but can't find anything that would resemble such a ...
66
votes
14answers
66k views
How can I remove bitnami banner on WordPress site?
I installed WordPress using Bitnami and now I have the Bitnami banner in the lower right corner of the page on that WordPress site. How can I remove it?
66
votes
13answers
80k views
Multiple excerpt lengths in wordpress
As it says in the title, I'm looking for multiple excerpt lengths in WordPress.
I understand you can do this in functions.php:
function twentyten_excerpt_length( $length ) {
return 15;
}
...
66
votes
5answers
301k views
Column count doesn't match value count at row 1
So I read the other posts but this question is unique. So this SQL dump file has this as the last entry.
INSERT INTO `wp_posts` VALUES(2781, 3, '2013-01-04 17:24:19', '2013-01-05 00:24:19'.
I'm ...
65
votes
13answers
173k views
Retrieve WordPress root directory path?
How can I retrieve the path to the root directory in WordPress CMS?