Created
May 19, 2015 05:51
-
-
Save halfempty/bd298513f47c52763857 to your computer and use it in GitHub Desktop.
WordPress Decoy Page
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
<?php | |
function decoy_page( $query ) { | |
global $wp; | |
if ( !is_admin() && $query->is_main_query() ) { | |
if ( ( $query->get( 'page_id' ) == get_option( 'page_on_front' ) && get_option( 'page_on_front' ) ) || empty( $wp->query_string ) ) { | |
echo 'This displays when set to A Static Page and the homepage is showing.'; | |
set_query_var( 'pagename', 'home' ); | |
} | |
} | |
} | |
add_action( 'pre_get_posts', 'decoy_page' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment