• Michael

    (@mikeyhoward1977)


    I have a CPT for which I have enabled REST and am using a custom class which extends the WP_REST_Posts_Controller class as I need additional validation prior to granting access to certain posts.

    I’m also using a custom namespace.

    All REST calls are working perfectly. My issue is when adding or editing my custom posts. I now just get a blank white screen (all other screens are fine). No errors being written (debug on).

    If I remove my custom namespace from my custom class the issue disappears.

    I can edit the posts if I hook into the use_block_editor_for_post_type filter and return false, but I want the block editor enabled.

    What could be causing this?

    • This topic was modified 4 years, 6 months ago by Michael. Reason: Additional info
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Clearly the cause is the namespacing ?? I’m not sure it’s feasible to namespace a class extension. How would the base class know how to reach your override methods?

    Are you sure a class extension is really necessary? There is typically an action or filter hook available to meet most needs.

Viewing 1 replies (of 1 total)
  • The topic ‘Extending WP_REST_Posts_Controller’ is closed to new replies.