Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter kahone85

    (@kahone85)

    Thanks, this solves the problem.

    add_filter( 'wpseo_opengraph_title', function($title){
    
    	global $post;
    	
    	$meta = get_post_meta($post->ID, '_yoast_wpseo_opengraph-title', true);
    	
    	// use post title only if og:title is not set
    	if( empty($meta) && !empty($post->post_title) ){
    		$title = $post->post_title;
    	}
    	
    	return $title;
    });
    Thread Starter kahone85

    (@kahone85)

    Than you for your reply.

    I need more than that. I need two different templates: for document title, it should be:
    %%title%% %%sep%% %%sitename%% and for og:title it should be just %%title%%. If I change it from settings to %%title%%, it will be same in both. If there is a filter for changing document title, then this approach could be viable.

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