Remove Yoast WordPress SEO on a page

不问归期 提交于 2019-12-05 20:29:08

Enqueing is not the right moment to remove an action, use template_redirect instead:

add_action('template_redirect','remove_wpseo');

function remove_wpseo(){
    if ( is_page(944)) {
        global $wpseo_front;
        remove_action( 'wp_head', array($wpseo_front, 'head'), 2 ); // <-- check priority
    }
}

Check the priority that the plugin uses to add the wp_head action as the removal has to be the same and none if empty.

Just in case someone still needs this. This worked for me. Change 'page' to 'post' if it's a blog post. Instead of trying to throw out Yoast completely, just hide the meta box.

add_action( 'add_meta_boxes', 'remove_post_meta_boxes', 11 );

function remove_post_meta_boxes() {
    if( isset( $_GET['post'] ) && $_GET['post'] == '22' ) {
        remove_meta_box( 'wpseo_meta', 'page', 'normal' );
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!