Category Archives: WordPress

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 […]

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);

Disable Plugin and Theme Update and Installation on WordPress

Prevents users from being able to update or install plugins and themes, plus removes the “Editor” menu so users can’t edit files. Add this line to your wp-config.php file (above the “ABSPATH” otherwise it won’t work): define(‘DISALLOW_FILE_MODS’, true);define(‘DISALLOW_FILE_MODS’, true); To allow plugins and themes installation and updates but disable only the file editor, use this: […]

Change Siteurl with MySQL Queries on WordPress

To change the siteurl of your WordPress site, use these SQL queries: UPDATE wp_options SET option_value = replace(option_value, ‘’, ‘’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’; UPDATE wp_posts SET guid = replace(guid, ‘’, ‘’); UPDATE wp_posts SET post_content = replace(post_content, ‘’, ‘’); UPDATE wp_postmeta SET meta_value = replace(meta_value, ‘’, ‘’);UPDATE wp_options SET option_value […]