Forums
Forums / Plugin: Yoast SEO - Advanced SEO with real-time guidance and built-in AI / Remove all SEO titles
(@beee)
8 years, 11 months ago
I’d like to remove all custom set SEO titles with a simple function.
I think it should be something like this, but I can’t manage (yet).
$post_args = array( 'post_type' => 'event', 'posts_per_page' => -1 ); $posts = get_posts( $post_args ); if ( $posts ) { foreach ( $posts as $item ) { // remove $item->_yoast_wpseo_title // remove $item->custom->_yoast_wpseo_title } }
(@scorpnetwork)
AFAIK – Yoast saves custom SEO titles into the meta value “_yoast_wpseo_title” so this should be your solution:
WARNING: Untested.
$post_args = array( 'post_type' => 'event', 'posts_per_page' => -1 ); $posts = get_posts( $post_args ); if ( $posts ) { foreach ( $posts as $item ) { delete_post_meta($item->ID, '_yoast_wpseo_title'); } }
*incorrect statement
I think your solution works though… will test now.
Works, thanks John.
The topic ‘Remove all SEO titles’ is closed to new replies.