Category Archives: WordPress

Create Custom Rest Endpoints for WP Rest API

I found a very nice WordPress plugin that can be used to add custom rest endpoints for WP Rest API without touching the PHP code! You can complex custom routes easily, for example you can create a GET route to retrieve all posts (title, permalink, ID, etc) in your WordPress blog; or create a POST […]

How to Downgrade WordPress to an Older Version

Today I installed WordPress 5.1.1 and it was a total mess. I had issues when publishing new posts, it was slower than v4.9.8, etc. So I decided to downgrade to v4.9.8 and to do this I installed: WP Downgrade | Specific Core Version It is a plugin that can help you downgrade to any previous […]

Htaccess file for WordPress websites

Create a .htaccess file on the root directory of your website. Then copy the content below on the .htaccess file: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / […]

Integrate Disqus on WordPress programmatically

To integrate Disqus programmatically on WordPress single.php just set: var disqus_config = function () { = ‘<?php echo get_permalink(); ?>’; // Replace PAGE_URL with your page’s canonical URL variable = ‘<?php echo intval(get_the_ID()); ?>’; // Replace PAGE_IDENTIFIER with your page’s unique identifier variable };var disqus_config = function () { = ‘<?php echo […]

WordPress Archive Page for Custom Post Type

Get archive link for a specific post type: <a href="<?php echo get_post_type_archive_link( ‘books’ ); ?>">Books List</a><a href="<?php echo get_post_type_archive_link( ‘books’ ); ?>">Books List</a> Set archive permalink for a custom post type when registering the cpt: $args = array( … ‘has_archive’ => ‘books-list’, // can be "true" or the permalink string );   register_post_type( ‘books’ , […]

WordPress Migrate from HTTP to HTTPS

Simple guide to migrate WordPress from HTTP to HTTPS: 1) Install free SSL certificate with Lets Encrypt 2) Enable SSL HTTP/2 for best performances 3) Change WordPress Site URL Open the Dashboard->Settings->General. Change to 4) Replace all http:// to https:// in post contents Use these MySQL queries to do the hard work: UPDATE […]

Disable WordPress Embeds

Some users have reported that the json URLs are sometimes indexed by Google:…… To disable WordPress embeds you can use this plugin: You can also remove these references in HTML head: <link rel=’’ href=’’ /> <link rel="alternate" type="application/json+oembed" href="…" /> <link rel="alternate" type="text/xml+oembed" href="…" /><link rel=’’ href=’’ /> <link rel="alternate" type="application/json+oembed" href="…" /> […]

Constant WP_POST_REVISIONS already defined

If you get this warning message in your WordPress website: Notice: Constant WP_POST_REVISIONS already defined in /var/www/wordpress/wp-config.php on line 95Notice: Constant WP_POST_REVISIONS already defined in /var/www/wordpress/wp-config.php on line 95 Make sure that the definition of the constant WP_POST_REVISIONS is after WordPress has been loaded. Edit wp-config.php and make sure WP_POST_REVISIONS is defined after require_once(ABSPATH . […]

Update a WordPress Plugin via UNIX Shell Prompt

Need to update a WordPress plugin via UNIX shell prompt? Open the /wp-content/plugins directory, example: cd /var/www/ /var/www/ Let’s say you need to update WordPress SEO plugin, type: rm -rf wordpress-seo wget unzip *.zip rm -f *.ziprm -rf wordpress-seo wget unzip *.zip rm -f *.zip That’s all!

Update WordPress from UNIX Shell Prompt

Need to update WordPress from UNIX shell prompt? Set the current directory to the root folder of WordPress installation: cd /var/www/ /var/www/ Now type these commands to update WordPress to latest version: rm -rf wp-admin rm -rf wp-includes mv wp-config.php wp-config.bak rm -f *.php mv wp-config.bak wp-config.php wget -O latest.tar.gz gunzip latest.tar.gz tar xf […]