No, it’s definitely not okay to comment your code this way. It changes the string, and even though WordPress might strip the incorrect characters and yield the correct pages (it wouldn’t if your “comments” contained comma’s or numbers), it is incredibly unstable. Instead, if you do want to comment them, I would suggest storing them as an array, commenting that in the way you described, and implode
-ing it with a comma:
$exclude_ids = array(
41, // First page title
43, // Second page title
);
wp_list_pages( array(
'exclude' => implode( ',', $exclude_ids ),
) );
Related Posts:
- How add a custom posttype name using ACF field to a query post array
- How can I pick a single post from the latest 3?
- Query all posts if multiple meta key don’t exist
- Include current post into loop
- How do I add a relation parameter to my filter query?
- When should you use WP_Query vs query_posts() vs get_posts()?
- Get post ids from WP_Query?
- Some doubts about how the main query and the custom query works in this custom theme?
- How to query for most viewed posts and show top 5
- Using OR conditions in meta_query for query_posts argument
- Order posts by ID in the given order
- Too slow when using both ‘tax_query’ and ‘meta_query’ both in WP_Query
- Get posts by menu ID
- Get the number of posts from the current page results
- How can I save an array from a random post sequence for later use?
- WordPress Custom Query to show posts from last x years
- Perform query with meta_value date
- Meta Query with date and time on the same Day before given time
- get_the_title($postID) OR get_the_title()?
- How do I create my own nested meta_query using posts_where / posts_join?
- Best practice for multiple queries on page
- WP Meta Query for some meta (array) values
- How to find out what “Blog pages show at most” is set to [duplicate]
- Retrieve or Query Pages by ID
- How do you query wordpress posts using a math formula between multiple meta field values?
- How to implement time filter to show random post 1 month for one category and 3 months for other categories
- Multiple instances of Featured Image Query
- How can I get an array of all IDs from the current queried object?
- 2 loops on page – one with orderby rand second orderby date
- How do you Query posts with nothing in common?
- Custom category search box for WordPress
- Order a query result by a numeric meta key even if it does not exist, but put the posts with meta key first
- Minimize database queries to user tables?
- Query with a meta value inside a given range
- (Solved) WP_Query ($ args) -> How to sort letters and numbers within the same array
- Store sticky post’s ids in a transient
- How to build a WP_Query using mulitple tags and using AND or OR operator between them
- Multiple loops without repeating content
- How to display multiple custom fields with the same meta_key in an ascending order?
- Bypass “supress_filters” in WP Query
- How to list custom fields as headers and list all pages sharing that custom field under it?
- How to display an other custom post type in a different custom post type’s archive?
- Display custom tags on pages that have a specific page parent
- How to increase load time of an archive/search page (WP_Query)
- How to query for all posts that have a particular meta key?
- Removing duplicate values between two wordpress queries
- Exclude All Posts Which Do Not Have A Tag Assigned
- How can I override one post and make it display content for another post?
- Get all posts which was posted on X Days WordPress
- Does meta_value (array) work with ‘orderby’?
- get_posts output always same post
- Conditional operator OR not working with custom fields
- complex get_posts() query to select child pages
- Get posts that do not have the same tags as current
- Should I reset $wp_query?
- Posts query according to meta box date
- WP_Query with page_ids in arguments without a result
- Query using string from custom field as array value
- Get next/prev image/attachment in time with date query
- Max Posts and Memory Limit
- Category based on post id
- specific post is not excluded from the loop
- Why doesn’t my WP Meta Query return any results?
- Trouble Making WP_Query paged
- How to query for a page, get data, then query for child pages of that page
- meta_query returning excluded result
- Optimising WP_Query with ACF Fields
- Query post and sort by custom value calculated with custom field on cpt
- Filter products on category AND tag
- Query post ordered by meta value that show first post that contained a tag
- Counting instances of words in the results of a post query
- WP Query by 4 different taxonomies
- Trouble with serialized metadata
- pre_user_query vs pre_get_posts
- How do I stop the same post showing multiple times in a archive?
- trying to change from query_post to WP_Query
- Problem with my loops
- Repeat array inside array through while loop
- WordPress For Loop Prints Unwanted Extra Paragraph Element
- My entry results are not consistently alphabetized
- Related Post by Tags Code
- How to order posts, that have already been filtered by custom taxonomy, by their category names?
- How to add in WP_Query to every 3 posts displayed? [duplicate]
- query_posts() doesn’t seem to be called in my page
- Modify query to exclude certain ids and certain parents and its corresponding children
- Some doubts about how the main query and the custom query works in this custom theme?
- Fetching $_POST from Page Template into functions.php
- How to order by datediff in WP loop?
- Ordering Posts by parent category, name ascending
- wp_query – Modify $query to include duplicate content
- Optimising specific Query with ACF meta objects
- How to get several fields from wp_query?
- How to sort a WP_Query array by post_name after an array_merge();
- WP Query posts__in not working with array
- query_posts with sorting on a custom datestamp
- Sort Posts with custom meta key by default which is currently set as optional
- Query Posts by date range with fixed beginning and end
- Exclude categories and subcategories in QueryLoop
- Incorrect posts displayed on category page
- How do I have multiple metaqueries inside one wordpress query