Category Archives: WordPress

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 () { this.page.url = ‘<?php echo get_permalink(); ?>’; // Replace PAGE_URL with your page’s canonical URL variable this.page.identifier = ‘<?php echo intval(get_the_ID()); ?>’; // Replace PAGE_IDENTIFIER with your page’s unique identifier variable };var disqus_config = function () { this.page.url = ‘<?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 http://www.yoursite.com to https://www.yoursite.com 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: http://www.site.com/wp-json/oembed/1.0/embed?url=http%3A…http://www.site.com/wp-json/oembed/1.0/embed?url=http%3A… To disable WordPress embeds you can use this plugin: https://wordpress.org/plugins/disable-embeds/ You can also remove these references in HTML head: <link rel=’https://api.w.org/’ href=’http://example.com/wp-json/’ /> <link rel="alternate" type="application/json+oembed" href="http://example.com/wp-json/oembed/1.0/embed?url=…" /> <link rel="alternate" type="text/xml+oembed" href="http://example.com/wp-json/oembed/1.0/embed?url=…" /><link rel=’https://api.w.org/’ href=’http://example.com/wp-json/’ /> <link rel="alternate" type="application/json+oembed" href="http://example.com/wp-json/oembed/1.0/embed?url=…" /> […]

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/wpsite.com/htdocs/wp-content/pluginscd /var/www/wpsite.com/htdocs/wp-content/plugins Let’s say you need to update WordPress SEO plugin, type: rm -rf wordpress-seo wget https://downloads.wordpress.org/plugin/wordpress-seo.3.9.zip unzip *.zip rm -f *.ziprm -rf wordpress-seo wget https://downloads.wordpress.org/plugin/wordpress-seo.3.9.zip 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/wpsite.com/htdocs/cd /var/www/wpsite.com/htdocs/ 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 https://wordpress.org/latest.tar.gz gunzip latest.tar.gz tar xf […]

Disable the Plugin and Theme Editor on WordPress

To disable only the file editor (but allow for plugins and themes installation), simply add this line to your wp-config.php file (above the “ABSPATH” otherwise it won’t work): define(‘DISALLOW_FILE_EDIT’, true);define(‘DISALLOW_FILE_EDIT’, true);