How To Configure Apache 2.4 to Renew LetsEncrypt running WordPress and https

Author: , August 21st, 2017

This post does not cover configuring letsencrypt or ssl/https. First, make sure your LetsEncrypt configuration points to the actual WordPress document root directory cat /etc/letsencrypt/renewal/www.yourdomain.com.conf 1 2 3 4 … [[webroot_map]] yourdomain.com = /volumes/data/www/yourdomain.com/prod/wordpress www.yourdomain.com = /volumes/data/www/yourdomain.com/prod/wordpress … [[webroot_map]] yourdomain.com = /volumes/data/www/yourdomain.com/prod/wordpress www.yourdomain.com = /volumes/data/www/yourdomain.com/prod/wordpress Second, use the new macro language feature in Apache 2.4 […]

How To Fix WordPress Missing “Add New” Button in Plugins and Menu Choice “Dashboard > Updates”

Author: , April 17th, 2017

If you are missing either your “Dashboard > Updates” menu choice, or the “Add New” button or menu choice in the Plugins section, do this to correct it: Edit the wp-config.php file, and change two lines to be false instead of true: For example, here are the two lines fixed: 1 2 define(’DISALLOW_FILE_EDIT’, false); define(’DISALLOW_FILE_MODS’,false); […]

How To Increase WordPress Memory After PHP Fatal error: Allowed memory size exhausted

Author: , February 13th, 2017

PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 277644940 bytes) in /volumes/data/customer/wordpress/wp-content/plugins/searchwp/vendor/pdfparser/vendor/smalot/pdfparser/src/Smalot/PdfParser/Parser.php on line 72, referer: http://dev.thecustomer.com/index.php?swpnonce=1387006674.5392169952592578125000 To increase the PHP memory limit to 256MB, edit wp-config.php and add the following just before the line that says “That’s all, stop editing! Happy blogging.”: 1 define( ‘WP_MEMORY_LIMIT’, ’256M’ ); define( ‘WP_MEMORY_LIMIT’, […]

How To Convert from mysql_ to mysqli_ in WordPress Plugins Easily

Author: , August 24th, 2016

As PHP deprecates old functions, sometimes code maintenance changes become required for long-running sites. As of PHP 5.5, the MySQL functions are deprecated and are removed in PHP 7! I recently had to convert multiple sites to mysqli PHP functions because a new server was running PHP 5.6 and the old server was on PHP […]

How To Display the Featured Image on a Single Post in WordPress Only for a Specific Category

Author: , January 24th, 2016

1 2 3 4 5 6 7 8 9 10 11 12 13 14 add_action( ‘genesis_entry_content’, ‘featured_post_image’, 8 ); function featured_post_image() {     $categories = get_the_category();     foreach ($categories as $category) {         // You can use slug, ID or any other identifier from the WP_Object         […]

How To Highlight The Active Page Link in MaxMegaMenu

Author: , January 21st, 2016

WordPress Admin -> Mega Menu -> Menu Themes Select the theme to edit, then scroll to the bottom and edit the area for the CSS Editor under Custom Styling. Add the following to affect the Menu Bar type menu: 1 2 3 4 5 6 #{$wrap} #{$menu} > li.mega-current-page-ancestor.mega-menu-item-has-children > a.mega-menu-link, #{$wrap} #{$menu} li.mega-current_page_item > […]

How To Select the Max Numeric in a Varchar Column in MySQL

Author: , October 2nd, 2015

I needed to automate the addition of new users with a sequential member’s ID in WordPress. Additionally, there were non-numeric entries in that column that had to be ignored. The wp_users.user_login column is a varchar(60) and so does not naturally handle numeric operations well at all. The solution is a combination of REGEXP and cast(): […]

How To Find the Template File Name per Page in WordPress using SQL

Author: , September 5th, 2015

1 SELECT DISTINCT `meta_value` FROM `wp_postmeta` WHERE `meta_key` LIKE ‘_wp_page_template’ SELECT DISTINCT `meta_value` FROM `wp_postmeta` WHERE `meta_key` LIKE ‘_wp_page_template’

How To Add a Login/Logout Menu Link in WordPress

Author: , January 19th, 2015

Simple Link 1 2 3 4 5 6 7     $redirect = ( is_home() ) ? false : get_permalink();     if ( is_user_logged_in() ) {         $link = ‘<a href="&#039; . wp_logout_url( $redirect ) . &#039;" title="Log Out" class="broken_link">Log Out</a>’;     } else {         $link […]

How To Block WordPress XMLRPC Attacks

Author: , July 8th, 2014

Add the following to either your .htaccess file or to your Apache config: 1 2 3 4 <Files xmlrpc.php> Order allow,deny Deny from all </Files> <Files xmlrpc.php> Order allow,deny Deny from all </Files>