Questions tagged [wordpress]

Consider using . 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 .

Filter by
Sorted by
Tagged with
755 votes
21 answers

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 ...
Scott B's user avatar
  • 38.9k
641 votes
34 answers

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 ...
user77413's user avatar
  • 30.2k
399 votes
15 answers

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 ...
John Crawford's user avatar
333 votes
17 answers

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:, server:,...
Vidyut's user avatar
  • 3,489
311 votes
22 answers

#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’
Shishil Patel's user avatar
306 votes
19 answers

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 (...
citronic's user avatar
  • 9,898
294 votes
25 answers

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 ...
novicePrgrmr's user avatar
  • 18.7k
271 votes
21 answers

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'...
Henry's user avatar
  • 5,215
258 votes
18 answers

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 ...
Jason's user avatar
  • 4,919
248 votes
8 answers

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 ...
John Connor's user avatar
  • 3,367
211 votes
28 answers

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
Apeiron's user avatar
  • 1,891
207 votes
42 answers

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 ...
Tristan G's user avatar
  • 2,167
204 votes
19 answers

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 ...
Nasser Hadjloo's user avatar
198 votes
14 answers

#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: #...
Wairimu Murigi's user avatar
188 votes
5 answers

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? or ...
Dan's user avatar
  • 3,750
183 votes
19 answers

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 ...
Bernard's user avatar
  • 16.2k
180 votes
11 answers

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.
user avatar
176 votes
4 answers

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 ...
Marky34's user avatar
  • 1,763
175 votes
22 answers

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 ...
ManpreetSandhu's user avatar
172 votes
18 answers

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?
sasi kanth's user avatar
  • 2,657
166 votes
16 answers

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?
leora's user avatar
  • 189k
164 votes
10 answers

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 ...
atwellpub's user avatar
  • 5,690
149 votes
9 answers

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 ...
InvalidSyntax's user avatar
149 votes
20 answers

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 ...
Citizen's user avatar
  • 12.5k
149 votes
6 answers

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 ...
AidanCurran's user avatar
  • 2,460
143 votes
4 answers

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?
Tim's user avatar
  • 1,433
142 votes
14 answers

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 ...
dcolumbus's user avatar
  • 9,604
138 votes
6 answers

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?
Faisal Ijaz's user avatar
  • 1,812
133 votes
25 answers

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 ...
Adam's user avatar
  • 8,859
131 votes
9 answers

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] =...
Ravikumar Sharma's user avatar
125 votes
7 answers

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 ...
Morgan Cheng's user avatar
  • 74.1k
104 votes
6 answers

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 ...
user2705462's user avatar
  • 1,049
103 votes
9 answers

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->...
ShintoTuna's user avatar
  • 3,687
102 votes
3 answers

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 ...
Samuel LOL Hackson's user avatar
101 votes
7 answers

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 ...
George Oiko's user avatar
  • 1,423
97 votes
4 answers

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?
Olivier Lalonde's user avatar
96 votes
22 answers

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 ...
dsal1951's user avatar
  • 1,640
95 votes
16 answers

Retrieve WordPress root directory path?

How can I retrieve the path to the root directory in WordPress CMS?
Aadi's user avatar
  • 6,959
92 votes
12 answers

How To Include CSS and jQuery in my WordPress plugin?

How To Include CSS and jQuery in my WordPress plugin ?
faressoft's user avatar
  • 19.1k
92 votes
1 answer

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 ...
Alex McGill's user avatar
  • 1,025
91 votes
13 answers

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 ...
RonnieT's user avatar
  • 2,193
90 votes
6 answers

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 ...
CyberCatHK's user avatar
  • 1,060
86 votes
12 answers

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 ...
ryonlife's user avatar
  • 6,563
85 votes
4 answers

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 ...
Thamaraiselvam's user avatar
84 votes
6 answers

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 ...
Sziro's user avatar
  • 1,273
82 votes
17 answers

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....
Cristiano Maia's user avatar
80 votes
21 answers

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
furyfish's user avatar
  • 2,065
80 votes
9 answers

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 but it ...
Chuck D's user avatar
  • 1,728
80 votes
4 answers

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 ...
Prashanth's user avatar
  • 801
80 votes
11 answers

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 ...
Atif's user avatar
  • 10.6k

2 3 4 5