• Hello,

    When I create a new post using the API, the author attribute is ignored and the default author is used (the one that is logged in using the API). I tried to update the post also with no success (the author is not changed). I have tried the author login name and the author email as values but the result is the same.

    Can you please help?

    To your disposal for further clarification/inquiries.

    Best regards,
    Byron

Viewing 1 replies (of 1 total)
  • Thread Starter kioub

    (@kioub)

    Hello,

    I troubleshooted it myself.

    The issue is in the json-api/singletons/introspector.php class and more specifically at the following function:

    public function get_author_by_login($login) {
    global $wpdb;
    $id = $wpdb->get_var($wpdb->prepare(”
    SELECT ID
    FROM $wpdb->users
    WHERE user_nicename = %s
    “, $login));
    return $this->get_author_by_id($id);
    }

    You are selecting based on the “user_nicename” where you should use the “user_login”

    Please correct this ASAP and include it in the next version.

    Best regards,
    Byron

Viewing 1 replies (of 1 total)
  • The topic ‘Author attribute is ignored when creating/updating a post’ is closed to new replies.