disable auto generate meta description if Excerpt is not empty

#11171
  • Resolved kang dulba
    Rank Math free

    haloo can u add buton to setup this one, please make buton to disable this feature. on next upload

    
    /**
     * The Singular Class
     *
     * @since      1.0.22
     * @package    RankMath
     * @subpackage RankMath\Paper
     * @author     Rank Math <s******@r***********>
     */
    
    **************
    		// 2. Excerpt
    		if ( ! empty( $object->post_excerpt ) ) {
    			return $object->post_excerpt;
    		}
Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello,

    Thank you for contacting Rank Math today.

    This would make a great addition to the plugin. I have submitted the same to our dev team and hopefully this will be addressed in a future update.

    Looking forward to helping you. Thank you.

    ​​​​​​

    great thank you

    Hi @kangdulba

    Feel free to contact us for any other suggestions or questions.

    Thank you.

    Hello @kangdulba,

    You can use below filter code to show the Description from Settings if it’s not added in the Description field in Post metabox:

    
    add_action( 'rank_math/frontend/description', function( $description ) {
    	global $post;
    	$desc = RankMath\Post::get_meta( 'description', $post->ID );
    
    	if ( ! $desc ) {
    		$desc = RankMath\Helper::get_settings( "titles.pt_{$post->post_type}_description" );
    		if ( $desc ) {
    			return RankMath\Helper::replace_vars( $desc, $post );
    		}
    	}
    
    	return $description;
    });
    

    Hope that helps. Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)

The ticket ‘disable auto generate meta description if Excerpt is not empty’ is closed to new replies.