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:
use a function that collects an array of ID of pages with
get_pages()
then use that array in conjunction with
post__not_in
andpre_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 ?
get_posts
orget_pages
? You mention both.exclude
) that can be passed both toget_posts()
andget_pages()
? Does that parameter work? If not, why not? What happens?get_pages()
. @Chip_Bennett : I can't change the arguments without modifying the plugin, but i'd rather not to keep it updated regulary. That's why I would hook the functionget_pages()
: to change the result without changing the code of the plugin.get_pages()
so I am sorry but I don't really know what the question is or what needs to be solved. It is not clear.get_pages()
. I want to change the behavior of this plugin without hacking its core. So I figured that I could change theget_pages()
output, because it will change the output of the plugin. Doing so, I find how to filterget_pages()
, and this is my solution below for documentation, but I also find out that the plugins uses two other functions that I cannot bypass or filter, so my attempt for this particular case is a dead-end.