Title: Need Help with the Exclude code
Last modified: August 19, 2016

---

# Need Help with the Exclude code

 *  Resolved [hazelbug](https://wordpress.org/support/users/hazelbug/)
 * (@hazelbug)
 * [17 years, 7 months ago](https://wordpress.org/support/topic/need-help-with-the-exclude-code/)
 * Hi,
    [Here is the site I am working on](http://www.jkltd.com/newsite). I need
   to exclude certain pages, but I don’t know how to add it to the code.
 * When I tried to alter the `<?php wp_list_pages(‘exclude=17,38’ ); ?>
    ` it messes
   up the page.
 * The code looks a bit different so I tried to also add
    `get_page_by_title('3x5
   Rugs')->ID,` to the code bc it looked like they were excluding certain pages 
   that way.
 * Here is the PHP Code
 *     ```
       <?php wp_head(); ?>
       </head>
       <body>
       	<div id="page">
       		<div id="header">
       			<div id="headerimg">
       				<h1><a href="<?php echo get_option('home'); ?>/"><?php bloginfo('name'); ?></a></h1>
       				<div id="description"><?php bloginfo('description'); ?></div>
       				<div id="menu">
       					<ul>
       						<?php
       $page_ids = array(get_page_by_title('Mailing List')->ID,
                                                                                                                                                                       get_page_by_title('Newsletter')->ID);
   
       							$page_ids = join(', ', $page_ids);
       							$args = array('title_li' => '', 'exclude' => $page_ids);
       							wp_list_pages($args);
       						?>
       					</ul>
       				</div>
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [viceng](https://wordpress.org/support/users/viceng/)
 * (@viceng)
 * [17 years, 7 months ago](https://wordpress.org/support/topic/need-help-with-the-exclude-code/#post-905527)
 * Hi,
 * I think you need something like
 * <?php wp_list_pages(‘title_li=&sort_column=menu_order&exclude=62,75’); ?>
 * I believe you left out the ‘title_li= part.
 *  Thread Starter [hazelbug](https://wordpress.org/support/users/hazelbug/)
 * (@hazelbug)
 * [17 years, 7 months ago](https://wordpress.org/support/topic/need-help-with-the-exclude-code/#post-905638)
 * Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Need Help with the Exclude code’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [hazelbug](https://wordpress.org/support/users/hazelbug/)
 * Last activity: [17 years, 7 months ago](https://wordpress.org/support/topic/need-help-with-the-exclude-code/#post-905638)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
