Source: (Case Study) This SEO Checklist = 48.7% More Organic Traffic
- Step #1: Delete “Dead Weight” Pages
- WordPress category and tag pages
- Outdated blog posts
- Low-quality blog posts
- Ecommerce product pages with zero sales
| <?php | |
| // add a favicon | |
| function favicon_link() { | |
| echo '<link rel="shortcut icon" type="image/x-icon" href="http://www.thivinfo.com/wp-content/themes/thivinfo_v3/favicon.ico" />' . "\n"; | |
| } | |
| add_action( 'wp_head', 'favicon_link' ); | |
| <?php | |
| //* Add new image sizes | |
| add_image_size( 'logo-thumb', 270, 180, TRUE ); | |
| //* Change the number of portfolio items to be displayed (props Bill Erickson) | |
| add_action( 'pre_get_posts', 'minimum_portfolio_items' ); | |
| function minimum_portfolio_items( $query ) { | |
| if ( $query->is_main_query() && !is_admin() && is_post_type_archive( 'portfolio' ) ) { | |
| $query->set( 'posts_per_page', '6' ); |
| /** | |
| * Helper function for getting the widths and url's of all the available crops of an image. | |
| * @param Number $id : The id of the image that you need the info for | |
| * @param Array $image_sizes_to_exclude An array of strings with the names of image sizes to exclude from the output | |
| * @return Array An indexed array, where at each index there is an associative array with array["width"] containing an image width and array["url"] containing the corresponding image url. | |
| * Example: Array( | |
| * [0] => Array( | |
| * [width] => 300 | |
| * [url] => http://placehold.it/50x50 | |
| * ), |
Source: (Case Study) This SEO Checklist = 48.7% More Organic Traffic
| <?php | |
| // Retrieved from: http://wp-snippets.com/disable-self-trackbacks/ | |
| add_action( 'pre_ping', 'disable_self_ping' ); | |
| function disable_self_ping( &$links ) { | |
| foreach ( $links as $l => $link ) | |
| if ( 0 === strpos( $link, get_option( 'home' ) ) ) | |
| unset($links[$l]); | |
| } |
| <?php | |
| /** | |
| * WP Rocket: | |
| * 1. Customise order of minification and defer operations. | |
| * 2. Exclude file from defer JS only (still minified). | |
| * | |
| * Tested rudimentary with WP Rocket 2.11.7 and 3.0.x. | |
| * Test before using this in production! | |
| */ | |
| add_action( 'wp_rocket_loaded', function () { |
| <?php | |
| /** | |
| * Plugin Name: WP Rocket | UnLazyLoad Essential Grid | |
| * Description: Disables WP Rocket’s LazyLoad feature on pages with <a href="https://www.themepunch.com/portfolio/essential-grid-wordpress-plugin/">Essential Grid</a>. | |
| * Author: WP Rocket Support Team | |
| * Author URI: http://wp-rocket.me/ | |
| * Plugin URI: http://docs.wp-rocket.me/article/139-disable-lazyload-on-mobile#inactive | |
| * License: GNU General Public License v3 or later | |
| * License URI: http://www.gnu.org/licenses/gpl-3.0.html | |
| */ |
| # Custom Security Measures by @voneff | |
| # | |
| # Sources: | |
| # @link https://gist.github.com/voneff/f66128aaacd350294e8a | |
| # @link https://premium.wpmudev.org/blog/keeping-wordpress-secure-the-ultimate-guide | |
| # @link https://kinsta.com/blog/wp-config-php/ | |
| # @link https://kittpress.com/wordpress-sicherheit-2-erste-konfiguration/ | |
| # | |
| # Turn Off PHP Error Reporting: |
| <?php | |
| /* | |
| * Disable version information from being displayed in the header or RSS feed | |
| * | |
| * Sources: | |
| * http://torquemag.io/2016/06/keep-your-wordpress-site-safe-with-these-four-tips/ | |
| */ | |
| function disable_version_info() { |
| <?php | |
| /** | |
| * Disable WordPress emojis | |
| * Source: https://kinsta.com/knowledgebase/disable-emojis-wordpress/#disable-emojis-code | |
| */ | |
| function disable_emojis() { | |
| remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); | |
| remove_action( 'admin_print_scripts', 'print_emoji_detection_script' ); | |
| remove_action( 'wp_print_styles', 'print_emoji_styles' ); |