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
- WordPress post-template null warnings
- How can I edit the content in index.php? [duplicate]
- need help with existing code showing subpages
- Automatic Shortcode Creation with Custom Fields [closed]
- Woocommerce Show Single Product on Homepage
- Is the “_s” on this `sprintf(__(‘Page %s’, ‘_s’), max($paged, $page))` just refer to a text domain?
- how to show only specific category for a template
- Show a different code on front page to other pages
- Can’t print Yoast meta description into page template (syntax error, unexpected ‘.’) [closed]
- Using same variable names in files added with get_template_part()
- Inject class in body when particular page template is used
- PHP include is only working in certain places in my custom WP theme
- Use WordPress function in php file
- How to get all author posts outside of author templates
- Add filter multiple times using only one master function
- Create a Blog Template Page
- Showing latest post without 301 redirect
- Show meta box only for default page template
- Is there a way to hook or call a custom woocomerce template that is not part of the default templates of woocommerce?
- Normal PHP array for exclude section of WordPress query?
- Display custom field on 404 page outside loop
- single.php with different look by category
- How to call multiple functions from multiple files into a WordPress page template [closed]
- Display all pages – in order
- How do I remove a category from a wordpress loop>
- 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
- Function Reference Documenting Template Tags for use in Custom Theme Templates?
- Removing WordPress Footer -without access to PHP code?
- How to set a template with wp_insert_post
- Why is a wp function used in current PHP namespace’s callback not resolved to global scope?
- Why does the Woocommerce grouped template prints the unpublished products?
- Adding conditional text to a PHP Shortcode Template
- Create page template via functions.php?
- Short code template + ajax
- page-slug.php not working but only for specific slug
- What’s a good way to allow overwriting files within a child theme if I want the same folder structure?
- how to display this functions?
- is_page_template showing partial results
- Adding regular php file to site
- Advice on creating a WP Archive Template with Custom Taxonomy (get_term_meta)
- add_filter function concatenate string and locate_template function
- How to render a block from php template
- Template Loop – add switch case php
- get_page_template_slug returns incorrect path
- Override Admin menu icon
- Post repeated when opening in overlay, how do I solve this? [closed]
- Dropdown menu for categories
- How to suppress template-parts in undescores?
- Need help with pagination
- How can I get “Previous” and “Next” to show in the navigation besides the links?
- 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
- Splitting the_content() by size?
- Gravity Forms merge tags in templates?
- Unable to render custom field after attempt to generate a list of recent post in page template
- How to add new CSS file to new PHP file
- Make a page (url) not cacheable [closed]
- php loading different structure than source code
- pass html code to worpdress
- Some problems calling a function into sprintf() inside functions.php template file [closed]
- Display additional page templates and a sidebar on plugin activation
- How do I add my PHP app to a WordPress page whilst keeping semantic URLs?
- Getting a WordPress tag to print inside of a traditional php echo
- Why wp_remote_get() fetches certain web pages while it doesn’t work for my localhost?
- Loading Elementor templates in a Bootstrap modal on button clicking
- Integrate admin plugin into template. Very interesant (live search + autocomplete with wp rest api, in vanilla js)
- Require()/Include() post template adding extra content
- Display articles with a different template in the home page | Solved |
- Contain multiple page templates in one PHP custom template file in WordPress?
- Display metabox galleries on specific page template in admin editor
- Display WordPress archive template page in 3 columns and not 1 column [closed]
- Run do_shortcode on php template using JS function
- How to hardcode header and footer in WP?
- What are the advantages/disadvantages of ways to use php template files?
- Change the “Show All” button in a WordPress Portfolio Filter
- Check if current post in loop is last on current page
- WordPress add custom search
- 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 Change Site Elements based on referring URL
- How to add a full working piece of website already coded, to a large scale Website design project?