Follow this tutorial for a smooth way to implement SEO optimization using Rank Math instead of Yoast for the Content Farming v4 workflow
By default the content farming v4 workflow is optimized for Yoast, the following code allows you to enter seo title and description without altering the n8n workflow
function register_rankmath_meta_in_rest_keep_names() {
register_rest_field('post', 'yoast_description', array(
'get_callback' => function($post) {
return get_post_meta($post->ID, 'rank_math_description', true);
},
'update_callback' => function($value, $post) {
return update_post_meta($post->ID, 'rank_math_description', sanitize_text_field($value));
},
'schema' => array(
'type' => 'string',
'description' => 'Meta description (stored in Rank Math)',
),
));
register_rest_field('post', 'yoast_keyword', array(
'get_callback' => function($post) {
return get_post_meta($post->ID, 'rank_math_focus_keyword', true);
},
'update_callback' => function($value, $post) {
return update_post_meta($post->ID, 'rank_math_focus_keyword', sanitize_text_field($value));
},
'schema' => array(
'type' => 'string',
'description' => 'Focus keyword (stored in Rank Math)',
),
));
}
add_action('rest_api_init', 'register_rankmath_meta_in_rest_keep_names');
To implement it, Go to Appearance (1) -> Theme File Editor (2) -> Functions.php (3) -> paste the code to the bottom of the code (4)

