How to Setup Meta Description while creating Post using WordPress Rest API

#577016
Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for reaching out to us and bringing your concern to our attention.

    You need to pass a property data with the meta name called rank_math_description along with your title, content, status, and so on.

    Here’s an example of how to do that:

    $post_data = array(
    	'title'   => 'Your programmatically added post',
    	'status'  => 'draft',
    	'rank_math_description' => 'Your Rank Math meta description'
    );
    
    $request_args = array(
    	'headers' => array(
    			'Authorization' => 'Basic ' . base64_encode( "admin:admin" )
    	),
    	'body' => $post_data
    );
    
    wp_remote_post(
    	'http://DOMAIN.COM/wp-json/wp/v2/posts',
    	$request_args
    );

    Hope that helps and please do not hesitate to let us know if you need my assistance with anything else.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 1 replies (of 1 total)

The ticket ‘How to Setup Meta Description while creating Post using WordPress Rest API’ is closed to new replies.