This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/ | |
/* Remove Yoast SEO Change existing title or meta template variable | |
* Credit: Moshe Harush | |
* https://stackoverflow.com/questions/36281915/yoast-seo-how-to-create-custom-variables | |
* Last Tested: Unknown | |
*/ | |
// define the wpseo_replacements callback | |
function filter_wpseo_replacements( $replacements ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/ | |
/* | |
* Yoast SEO return `?replytocom` variables | |
* Credit: Yoast development team | |
* Last Tested: Mar 23 2018 using Yoast SEO 7.1 on WordPress 4.9.4 | |
*/ | |
add_filter( 'wpseo_remove_reply_to_com', '__return_false' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/ | |
/* Remove Yoast from front end for a single post or page | |
* Credit: Dodinas https://stackoverflow.com/questions/37845968/disable-wordpress-yoast-seo-on-single-page | |
* Last Tested: Nov 08 2019 using Yoast SEO 12.4 on WordPress 5.2.4 | |
* Note: For version 14+, please use the code here: https://developer.yoast.com/customization/yoast-seo/disabling-yoast-seo | |
********* | |
* DIFFERENT POST TYPES | |
* Post: Change 123456 to the post ID | |
* Page: Change is_single to is_page and 123456 to the page ID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/ | |
/* Include empty terms in the sitemap | |
* Credit: Yoast team | |
* Last Tested: Mar 22 2019 using Yoast SEO 10.0.1 on WordPress 5.1.1 | |
*/ | |
add_filter('wpseo_sitemap_exclude_empty_terms', '__return_false'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/ | |
/* Disable jquery / JavaScript in Yoast SEO Local | |
* Credit: Bill Erickson https://www.billerickson.net/ | |
* Last Tested: Unknown | |
*/ | |
add_filter( 'wpseo_local_load_jquery', '__return_false' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/ | |
/* Sync post meta to Yoast Indexable | |
* Credit: Yoast team | |
* Last Tested: Dec 20 2022 using Yoast SEO 19.13 on WordPress 6.1.1 | |
*/ | |
// The ID of the post to modify | |
$post_id = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/ | |
/* Prevent Yoast SEO for adding specific post types to indexables | |
* Credit: Yoast team | |
* Last Tested: Jan 18 2021 using Yoast SEO 15.6.2 on WordPress 5.6 | |
* Documented: https://github.com/Yoast/wordpress-seo/blob/trunk/src/helpers/post-type-helper.php#L90 | |
* Common post types: 'post', 'page', 'attachment', 'product' | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/ | |
/* Add custom separators to the Yoast SEO options | |
* Credit: Yoast team | |
* Last Tested: September 2, 2021 using Yoast SEO 17.0 on WordPress 5.8 | |
*/ | |
add_filter( 'wpseo_separator_options', 'yoast_seo_title_add_separators', 10 , 1 ); |