Created
October 24, 2012 13:37
-
-
Save vanderwijk/3946090 to your computer and use it in GitHub Desktop.
Exclude pages from wp_list_pages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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