• Hi Richard

    We are using this snippet to get sub page by slug something like wp-json/wp/v2/pages?path=/parent-slug/child-slug

    add_filter('rest_page_query', function ($args, $request){
    $path = $request->get_param('path');
    if (!empty($path)) {
    $pageByPath = get_page_by_path($path, OBJECT, 'page');
    // overwrite the page id with the page id by path
    $args['p'] = $pageByPath->ID;
    }
    return $args;
    }, 10, 2);

    When we install your plugin it throws error.

Viewing 1 replies (of 1 total)
  • Plugin Author Richard Korthuis

    (@rockfire)

    Hi @dezvolta

    Thank you for using our plugin!

    I just did a test on a clean WordPress install with your code snippet and our plugin. I didn’t get any error. Can you tell me what error you got?

Viewing 1 replies (of 1 total)
  • The topic ‘Plugin throws error’ is closed to new replies.