• Resolved CHEWX

    (@chewx)


    Hi,

    Using the WordPress API V2 for a mobile app.

    I have got my custom post types by adding.

    add_action( 'init', 'add_events_to_json_api', 30 );
    function add_events_to_json_api(){
    
        global $wp_post_types;
        $wp_post_types['cpt']->show_in_rest = true;
        $wp_post_types['cpt']->rest_base = 'cpt';
        $wp_post_types['cpt']->rest_controller_class = 'WP_REST_Posts_Controller';
    }

    This is good but only gets the latest posts. I want to get posts with a status of ‘published’.

    In the docs it says you need to request as a user with edit posts to be able to filter on ‘post_status’.

    I don’t really want to setup oAuth for this, is it possible to query this server side and add it to the API ?

    Thanks

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Query 'post_status' – WordPress Api V2’ is closed to new replies.