Inserting Post Using wp_insert_post. How to Fill Rank Math SEO Fields

  • I am inserting posts via an android app , using wp_insert_post function

    $post = array(
    ‘post_excerpt’ => “My_Test”,
    ‘comment_status’ => ‘open’,
    ‘post_content’ => $post_body,
    ‘post_name’ => $post_title,
    ‘post_status’ => ‘draft’,
    ‘post_title’ => $post_title,
    ‘post_type’ => ‘post’,
    ‘post_category’ => array(3634,154, $post_categories_array),
    ‘post_author’ => 1,
    ‘tags_input’ => $post_tags,
    ‘meta_input’ => array(
    ‘source’ => $source_name,
    )
    );
    $post_id = wp_insert_post($post);

    My question is how can i insert title , description and other seo data with wp_insert_post

    Thank you

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    Rank Math stores the SEO post metadata inside custom meta fields, so you will need to save that SEO data in the meta fields like:

    rank_math_title or rank_math_description

    Looking forward to helping you. Thank you.

    ​​​​​​​

Viewing 1 replies (of 1 total)

You must be logged in to reply to this ticket.