Home / Admin / Dynamically Change the SEO Title of a Specific Post Before the Metadata is Saved
Duplicate Snippet

Embed Snippet on Your Site

Dynamically Change the SEO Title of a Specific Post Before the Metadata is Saved

The code snippet below can be used to dynamically change the SEO title of a specific post before the metadata is saved.

10+
Code Preview
php
<?php
add_filter( "aioseo_save_post", "aioseo_filter_post_data" );
function aioseo_filter_post_data( $post ) {
	if ( 10 === (int) $post->post_id ) {
		$post->title = 'Some new title here';
	}
	return $post;
}

Comments

Add a Comment