wp query – Use get_pages() before another plugin modifies it

Question

In my little plugin I am using get_pages() to get some specific pages. Important is the usage of “child_of” and a custom field key.

$pages = get_pages([
    'child_of' => 206, //Gets children and grandchildren
    'sort_column' => 'menu_order',
    'meta_key' => 'os_class_page_type',
]);

Now there is another plugin in my WP installation (DigiMember) which blocks pages to users which do not have access to the page.

The big problem: Digimember also filters the “get_pages” function so I can’t use it to receive blocked pages. But I really need that to create some kind of overview of these pages.

I tried to call get_pages() earlier but it’s not working before ‘plugins_loaded’ action is called. So I can’t use it before DigiMember modifies it.

How can I used get_pages before it gets modified?

I could use WP_Query, but for WP_Query calls ‘child_of’ does not exist (I still have no idea why). But I really need to get all children and grandchildren. Using get_pages() does that perfectly – when it works.

Any ideas what I can do? Thanks!

0
TimO 2 months 2021-12-08T14:54:20-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse