Local wordpress install only shows home page, all other pages Not Found

Log in to the admin panel (localhost/sitedirectory/wp-admin) and go to Settings->Permalinks and click Save Changes. Permalinks often need to be rebuilt after mirroring a site and updating the site url. You don’t need to change any settings, just hit save and it will rebuild the permalinks with the selected options. Also make sure the Apache … Read more

WordPress get user by meta data

Since WP v3.1 it’s ridiculously easy to search for a user by his/her meta key. Use the function get_users($args) (WP Documentation) The function takes an array of parameters, in your case you need get_users(array( ‘meta_key’ => ‘parent_id’, ‘meta_value’ => ’42’ ))

The requested URL /about was not found on this server

If all above point not work. Then try this one. I tried it. It’s working for me. Go /etc/httpd/conf/httpd.conf. Change the AllowOverride None to AllowOverride All. Restart the apache server. UPDATE 2017 For new versions of apache the file is called apache2.conf So to access the file, type sudo nano /etc/apache2/apache2.conf and change the correspondent … Read more

WordPress filter to modify final html output

WordPress doesn’t have a “final output” filter, but you can hack together one. The below example resides within a “Must Use” plugin I’ve created for a project. Note: I haven’t tested with any plugins that might make use of the “shutdown” action. The plugin works by iterating through all the open buffer levels, closing them … Read more

Where is the post featured image link stored in the WordPress database?

The featured image ID is stored in wp_postmeta with a meta_key called _thumbnail_id. Example: ╔═════════╦═════════╦═══════════════╦═══════════╗ ║ meta_id ║ post_id ║ meta_key ║ meta_value║ ╠═════════╬═════════╬═══════════════╬═══════════╣ ║ 200 ║ 4 ║ _thumbnail_id ║ 48 ║ ╚═════════╩═════════╩═══════════════╩═══════════╝ The actual thumbnail link is then contained in wp_posts with a post_type of attachment. Example: ╔════╦════════════╦═════════════════════════════════════════════════════╗ ║ ID ║ post_type ║ … Read more

WordPress REST API (wp-api) 404 Error: Cannot access the WordPress REST API

UPDATED NEW WAY I also faced similar problem in a local project. I used index.php after my project url and it worked. http://localhost/myproject/index.php/wp-json/wp/v2/posts If it displays a 404 error then update permalinks first (see “Paged Navigation Doesn’t Work” section If it works, maybe you need to enable mod_rewrite, on ubuntu: a2enmod rewrite sudo service apache2 … Read more

Retrieve WordPress root directory path?

Looking at the bottom of your wp-config.php file in the wordpress root directory will let you find something like this: if ( !defined(‘ABSPATH’) ) define(‘ABSPATH’, dirname(__FILE__) . “https://stackoverflow.com/”); For an example file have a look here: http://core.trac.wordpress.org/browser/trunk/wp-config-sample.php You can make use of this constant called ABSPATH in other places of your wordpress scripts and in … Read more