Support » Plugins » Hacks » Hack wp_head

  • Hi All,

    I’m trying to affect the wp_head to change to that one of another page. However, the normal workaround of wp_query is not working here. Any suggestions how I can get the wp_head of another page by its slug or ID?

    I have this now:

    $page_for_head = get_page_by_path( $redirect );
    
    $temp_query = $wp_query;
    
    $page_args = array(
    	'post_type'		=>	'page',
    	'page_id'		=> 	$page_for_head->ID
    );
    
    $wp_query = new WP_Query( $page_args );
    
    while ( have_posts() ) : the_post();
    
    	wp_head();
    
    endwhile;
    
    $wp_query = $temp_query;

    But this just returns the wp_head of the main page. Thanks in advance.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Hack wp_head’ is closed to new replies.