Daniel, exclude
parameter doesn’t accept array.
Use your code this way:
$exclude = [];
foreach(get_pages(['meta_key' => '_wp_page_template', 'meta_value' => 'page-templates/page-noindex.php']) as $page) {
$exclude[] = $page->post_id;
}
$args = array(
'exclude' => implode(",", $exclude),
'title_li' => '',
'sort_column' => 'menu_order, post_title',
'post_type' => 'page',
'post_status' => 'publish'
);
wp_list_pages($args);
I think you can refactor it better for your needs
Related Posts:
- Check if a menu is empty?
- Easiest way to show total number of subpages
- Switching between custom templates in a post type of the admin menu
- Custom Template 404 for specific custom post type
- how could I load a different template part by page
- Change title only in dynamic page
- Does wordpress templates always in files or in database?
- Adding wrapper elements in the_date() like in the_title()?
- WordPress template page name displayed on screen
- Prevent header and footer from loading on specific pages with template or plugin
- Loop on a wordpress Page instead of content coming from the WP text editor
- Getting only direct child pages in WordPress with get_pages
- How does printf( __( ) ); work?
- Return HTML Template Page with PHP Function
- Is there a way to parse shortcodes in PHP?
- Static Frontpage Pagination – Custom loop
- load/require specific php files for specific pages/templates/post types
- How to show only parents subpages of current page item in vertical menu?
- On this day PHP code
- How to loop over custom fields in a page template?
- Alter secondary loop to exclude posts from current page category
- Use Timber/Twig to pull an image by image ID [closed]
- Help with a custom page template – listing contents of childpages?
- Unable to set right time in admin and frontend template
- is_page_template not working as expected
- Blank space at beginning of tag?
- Add a Second Menu to a theme that only support 1 menu
- Custom excerpt function re-factoring
- Inject PHP code into “sidebar-content” – code before my WooCommerce sidebar widget?
- How to display user nickname (not display name) in PHP template?
- How to properly insert a link to a template in WordPress?
- Custom field value not saving when it contains a URL?
- Render ninja form inside markup
- creating a second image attachment template?
- How can I get a single php file that is the equivalent of an existing WordPress page?
- Custom search results page not working with empty search
- Can’t access variable outside for loop
- I have a problem in the order of enqueues while enqueuing stylesheets and scripts for a specific page in my function.php
- How to show single category archive
- Issues getting PHP to display in category pages
- Secondary navigation menu on one page
- Enable custom logo upload if logo is not in header
- How to target grandchild of post_parent using wp_list_pages
- How can I edit the content in index.php? [duplicate]
- Woocommerce Show Single Product on Homepage
- Is the “_s” on this `sprintf(__(‘Page %s’, ‘_s’), max($paged, $page))` just refer to a text domain?
- Show a different code on front page to other pages
- PHP include is only working in certain places in my custom WP theme
- How to get all author posts outside of author templates
- How do I define a lookup table that will work across all PHP elements of the template?
- Editing a PHP file to include a small text piece on every page
- persist a variable set in header.php all the way down to footer.php
- Why does the Woocommerce grouped template prints the unpublished products?
- page-slug.php not working but only for specific slug
- Advice on creating a WP Archive Template with Custom Taxonomy (get_term_meta)
- How to render a block from php template
- Override Admin menu icon
- How to suppress template-parts in undescores?
- Need help with pagination
- Creating custom page template from existing PHP site
- Posts are not looping through correctly
- How do I query a single data value from the wp_metadata table?
- Conditional string comparison failing for basename/slug
- How to add new CSS file to new PHP file
- Some problems calling a function into sprintf() inside functions.php template file [closed]
- Integrate admin plugin into template. Very interesant (live search + autocomplete with wp rest api, in vanilla js)
- Display articles with a different template in the home page | Solved |
- Check if current post in loop is last on current page
- How can I edit a php custom page template to work in other themes?
- Converting Array to String Issue [closed]
- ACF – Custom image for Product Tags not displaying
- Polylang and template files
- Roots Sage Symfony error when using override from template
- Page template not working when logged out
- How to create dynamic templates?
- Change WooCommerce template for PDF – access to custom field
- Exclude category and post from loop in custom category.php
- remove_action() not working in page template – Genesis
- What syntax is this? “{{post.price}}”
- can’t grab PHP $_POST variable
- How do I modify the Previous and Next Page posts on blog pages to include “previous” and “next” before the links?
- Highlight Single Page Ancestor
- PHP: Why does my code work in index.php but not a widget?
- Create page in templates for pages or the pages manager?
- Access methods in plugin template
- Create dynamic content from one WP page to multiple other pages
- Execute php in pages
- Why isn’t my link attribute getting my css?
- Problems With Query and/or Template Part and/or PHP
- Display pages from specific page template
- Odd page behaviour after removing sidebar
- get_permalink returning first letter
- Tables not showing divs and loop/php items
- Custom Archive Page
- How to refresh a template page on WordPress in 3 seconds – easiest method?
- Display custom meta box in my template file
- Twig+WordPress how to use array arguments inside a function?
- How to implement a custom sliding banner? [closed]
- redirect user from login page if is logged
- How to exclude first 2 posts from a specific category for a custom post type archive page