Created
March 22, 2018 18:47
-
-
Save wolfthemes/3e951fdfcdd1fdf2d803afde06a547e3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| /** | |
| * Exclude sticky posts from page. | |
| * | |
| * @param object $query | |
| */ | |
| function theme_name_ignore_sticky_posts( $query ) { | |
| if ( 26 === get_the_ID() && is_page() && $query->is_main_query() ) { // 26 is your page ID | |
| $query->set('post__not_in', get_option('sticky_posts') ); | |
| } | |
| } | |
| add_action( 'pre_get_posts', 'theme_name_ignore_sticky_posts' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment