rankmath / seo-by-rank-math

Rank Math is a revolutionary WordPress SEO Plugin that combines the features of many SEO tools and lets you multiply your traffic in the easiest way possible :bulb: :chart_with_upwards_trend: →
https://rankmath.com
108 stars 51 forks source link

Make Term Primary via API #197

Open BRadHoc opened 1 year ago

BRadHoc commented 1 year ago

Describe the bug A clear and concise description of what the bug is.

I'm trying to add posts that are displayed on our website from the wordpress API. However whenever a post is created, the "Make Term Primary" radio button isn't selected on the category. As a result, the post does not appear on the site.

To Reproduce Steps to reproduce the behavior:

Create an API request to the wordpress posts endpoint with a category. See how the category does not get selected as "Primary Term".

Expected behavior A clear and concise description of what you expected to happen.

The primary term should be selected automatically if there's only 1 category, or there should be a way to select it.

Screenshots If applicable, add screenshots to help explain your problem.

Screenshot 2023-06-22 at 9 34 05 am

Additional context Add any other context about the problem here.

I tried something like this and it still doesn't work:


$postData = array(
            'title' => $sai_title,
            'content' => $sai_body,
            'categories' => array(33),
            'status' => 'publish',
            'meta' => array(
                'rank_math_primary_category' => 33
            )
);
BRadHoc commented 1 year ago

Similar Question #152