Skip to:
Content
Pages
Categories
Search
Top
Bottom

Why is enabling rest API altering topic editor behavior?


  • huetherb
    Participant

    @huetherb

    Hi, I am trying to use the wordpress restAPI to get topic data. I am trying to do so via

    add_filter( ‘bbp_register_topic_post_type’, ‘enable_restAPI_bbpress_topics’, 10,1);
    function enable_restAPI_bbpress_topics ($args) {
    $args[‘show_in_rest’] = true;
    return $args;
    }

    That is to enable some functionality in another plugin.

    But for some reason, doing so causes the bbpress topic editor to alter behavior. It shows a different editor type.

    Instead of normal editor which shows a title field and then a content area below, it shows a Gutenberg block for title and content.

    But more importantly, when I submit a topic it gets saved with userid set to 0. The revision is saved with correct user id, but the post itself is saved with post_author 0.

    Any idea what is going on?

    Brian

Viewing 1 replies (of 1 total)

  • huetherb
    Participant

    @huetherb

    Here is what I needed to do:

    add_filter( ‘bbp_register_topic_post_type’, ‘enable_restAPI_bbpress_topics’, 10,1);
    function enable_restAPI_bbpress_topics ($args) {
    $args[‘show_in_rest’] = true;
    $args[‘supports’] = array( ‘title’, ‘editor’, ‘author’ );
    return $args;
    }
    Notice the supports variable. By including author that ensures post_author is set.

    Seriously, BBPress should simply include a setting in backend to enable restAPI. That is the direction that the web is heading in already, with headless CMS, decoupling front and and backend.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar