Skip to content

Instantly share code, notes, and snippets.

@vanderwijk
Created October 24, 2012 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vanderwijk/3946090 to your computer and use it in GitHub Desktop.
Save vanderwijk/3946090 to your computer and use it in GitHub Desktop.
Exclude pages from wp_list_pages
function mx_hide_from_list_pages( $exclude_array ) {
global $wpdb;
$table = _get_meta_table('post');
$sql = "SELECT post_id FROM " . $table . " WHERE meta_key ='_smartmeta_navigation_hide' AND meta_value ='true'";
$id_array = $wpdb->get_col($sql);
$exclude_array = array_merge($id_array, $exclude_array);
return $exclude_array;
}
add_filter( 'wp_list_pages_excludes', 'mx_hide_from_list_pages' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment