• Hey,

    you might consider supporting single_post_title() as well, though the surrounding heading-tags if used like <h1><?php echo single_post_title() ?></h1> in corresponding templates would still remain in the document…

    add_filter( 'single_post_title', function ( $title, $post ) {
    	if ( ! $post AND ! $post->ID ) {
    		return $title;
    	}
    
    	$hide_title = get_post_meta( $post->ID, 'wptr_hide_title', true );
    	if ( ! is_admin() && is_singular() && intval( $hide_title ) && in_the_loop() ) {
    		return '';
    	}
    
    	return $title;
    }, 10, 2 );

The topic ‘Maybe add support for single_post_title()’ is closed to new replies.