<?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' ); |
<?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 */ | |
} |
This comment has been minimized.
This comment has been minimized.
You could use: |
This comment has been minimized.
This comment has been minimized.
You can also check if is_tag() post type. This example capitalizes the title.
|
This comment has been minimized.
This comment has been minimized.
hello @roadsunknown i have same problem it always back empty value with custom post type work on pages and posts but not custom post type in page retern the value good the code
custom post type it back like that
im not sure why the post type this
|
This comment has been minimized.
Hi there, i'm facing problem when try to read Yoast var inside category template.
If i try to print the title with wp_title(), i get the correct snippet rewrite from yoast, but i'm not able to read description.
I did
get_term_meta($category->id, '_yoast_wpseo_title' ,true);
get_term_meta($category->id, '_yoast_wpseo_metadesc' ,true);
always return empty values. My question is how to read title and desc snippet by code side?