Questions tagged [wordpress]
Consider using https://wordpress.stackexchange.com . 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 https://wordpress.stackexchange.com .
192,583
questions
765
votes
21
answers
878k
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 ...
646
votes
32
answers
466k
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
15
answers
897k
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 ...
344
votes
19
answers
375k
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,...
328
votes
23
answers
678k
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’
308
votes
19
answers
380k
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 (...
302
votes
25
answers
641k
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 ...
272
votes
22
answers
484k
views
phpMyAdmin - Error > Incorrect format parameter?
I have a WordPress production website.
I've exported the database by the following commands: select database > export > custom > select all tables > select .zip compression > 'Go'
I'...
259
votes
19
answers
639k
views
Wordpress how to use jquery and $ sign
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 ...
254
votes
8
answers
355k
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 ...
224
votes
46
answers
662k
views
What's the net::ERR_HTTP2_PROTOCOL_ERROR about?
I'm currently working on a website, which triggers a net::ERR_HTTP2_PROTOCOL_ERROR 200 error on Google Chrome. I'm not sure exactly what can provoke this error, I just noticed it pops out only when ...
217
votes
29
answers
388k
views
Nginx serves .php files as downloads, instead of executing them
I am installing a website in a droplet (Digital Ocean). I have an issue for install NGINX with PHP properly. I did a tutorial https://www.digitalocean.com/community/tutorials/how-to-install-linux-...
208
votes
19
answers
1.2m
views
Access denied for user 'root@localhost' (using password:NO)
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 for MySQL and in the ...
198
votes
14
answers
407k
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:
#...
195
votes
5
answers
106k
views
Proper URL forming with a query string and an 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=val
...
186
votes
18
answers
183k
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?
184
votes
19
answers
504k
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.
But these don't work for ...
181
votes
11
answers
257k
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.
176
votes
22
answers
581k
views
How to get the WordPress post thumbnail (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 ...
176
votes
4
answers
138k
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 ...
169
votes
10
answers
302k
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 ...
166
votes
16
answers
150k
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?
154
votes
20
answers
364k
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 ...
151
votes
9
answers
347k
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 ...
150
votes
6
answers
164k
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 ...
144
votes
4
answers
109k
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?
142
votes
14
answers
339k
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 ...
140
votes
7
answers
443k
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?
138
votes
25
answers
270k
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 ...
134
votes
9
answers
159k
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] =...
128
votes
7
answers
180k
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 ...
110
votes
6
answers
533k
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 ...
104
votes
9
answers
290k
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->...
103
votes
8
answers
33k
views
VS Code highlighted all my wordpress function name
I am using PHP Intelephense(version 1.3.7) which is the latest version and my VS Code is up to date
There was no problem before but a few days ago, it keeps on highlighted all my wordpress function ...
102
votes
7
answers
170k
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 ...
102
votes
3
answers
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 ...
100
votes
22
answers
191k
views
Wordpress REST API (wp-api) 404 Error: Cannot access the WordPress REST API
I have been using the Wordpress REST plugin WP-API for months now while developing locally with XAMPP. I recently migrated my site to an EC2 instance and everything is working fine except I now get a ...
97
votes
16
answers
246k
views
Retrieve WordPress root directory path?
How can I retrieve the path to the root directory in WordPress CMS?
97
votes
4
answers
22k
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?
94
votes
12
answers
154k
views
How To Include CSS and jQuery in my WordPress plugin?
How To Include CSS and jQuery in my WordPress plugin ?
92
votes
13
answers
367k
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 ...
92
votes
1
answer
43k
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 ...
91
votes
4
answers
63k
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 ...
88
votes
11
answers
67k
views
Wordpress Docker won't increase upload limit
I am trying to increate the upload limit of my Dockerized Wordpress instance to 150M.
[filename] exceeds the maximum upload size for this site.
I have created an uploads.ini file and attached it by ...
87
votes
12
answers
65k
views
WordPress filter to modify final html output
WordPress has great filter support for getting at all sorts of specific bits of content and modifying it before output. Like the_content filter, which lets you access the markup for a post before it's ...
85
votes
8
answers
135k
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 ...
84
votes
21
answers
198k
views
Wordpress plugin install: Could not create directory
I'm using WordPress on centos 6.
I try to install a plugin. But I got this error:
Installing Plugin: bbPress 2.5.9
Downloading install package from https://downloads.wordpress.org/plugin/bbpress....
82
votes
17
answers
192k
views
Use .htaccess to redirect HTTP to HTTPs
I have tried this post, and many others (1, 2, 3, 4), but they all give me TOO_MANY_REDIRECTS or error 500. So, here is my issue:
With my current .htaccess, this is what happens:
https://www....
82
votes
19
answers
187k
views
Wordpress get plugin directory
Is there any function that would return the full path of my plugin in WordPress?
Example is
path/wp-contents/plugins/myplugin
I have tried plugin_dir_path(__FILE__) but returns the current dir.
82
votes
3
answers
80k
views
WordPress get user by meta data
How can I retrieve all users registered in my WordPress blog having a particular meta data?
For example I have made an option to add a custom meta data for every registering users having meta key as ...