Last active
February 17, 2022 14:57
-
-
Save amboutwe/34b80a4755b1a9140026bc2c82720114 to your computer and use it in GitHub Desktop.
Yoast SEO title snippets
This file contains hidden or 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 Title From All Pages | |
* Credit: Yoast Team | |
* Last Tested: Jun 17 2020 using Yoast SEO 14.3 on WordPress 5.4.2 | |
*/ | |
add_filter( 'wpseo_title', '__return_false' ); |
This file contains hidden or 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 Title From An Individual Post/Page/CPT | |
* Credit: Yoast Team | |
* Last Tested: Jun 17 2020 using Yoast SEO 14.3 on WordPress 5.4.2 | |
********* | |
* DIFFERENT POST TYPES | |
* Post: Change 123456 to the post ID | |
* Page: Change is_single to is_page and 123456 to the page ID | |
* Custom Post Type: Change is_single to is_singular and 123456 to the 'post_type_slug' | |
Example: is_singular( 'cpt_slug' ) | |
********* | |
* MULTIPLE ITEMS | |
* Multiple of the same type can use an array. | |
Example: is_single( array( 123456, 1234567, 12345678 ) ) | |
* Multiple of different types can repeat the if statement | |
*/ | |
add_filter( 'wpseo_title', 'remove_one_wpseo_title' ); | |
function remove_one_wpseo_title( $title ) { | |
if ( is_single ( 123456 ) ) { | |
return false; | |
} | |
/* Use a second if statement here when needed */ | |
return $title; /* Do not remove this line */ | |
} |
Needed to change in line 22 from is_single to is_page but then it worked like a charm for me. Searched the whole web and a longer time to fix this issue with wordpress, yoast and salient theme.
Big, big thanks amboutwe!!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is not the proper place to request support. Please check out our extensive help section or visit the free support forum. If you require further support, upgrading to our premium version provides you with access to our support team.