Hooking get_pages()


On a site this is a plugin that uses get_pages() to make a list of pages. The list is used to create a list of pages and create next page and previous page links. ( http://wordpress.org/plugins/next-page-not-next-post/ )

The structure of pages uses some empty pages just to make a hierarchy. Those pages are not in the navigation, which is controlled by wp_nav_menu(), but they are enlisted when the plugin calls get_pages()

So I want to remove those empty pages from the request made by the plugin.

My intent is to add a custom field to each unnecessary page, and to use this custom field to select and remove them.

I did a first attempt with pre_get_posts by:

  1. use a function that collects an array of ID of pages with get_pages()

  2. then use that array in conjunction with post__not_inand pre_get_posts

But it’s a deadhead since the get_pages() launched by the plugin is not the main query.

So my question is : is there a hook to the get_pages() so I can filter its results and by so, affect the behaviour of the plugin ?

, , Simon 10 years 2013-08-07T16:33:07-05:00 0 Answers 92 views 0

Leave an answer