• Hi,
    I try to alter a query and used the code below in a plugin file.

    It works without problems if I add it to another plugin I downloaded but I want to keep my modifications separate.

    I did some research and one guy said to someone with a similar problem that the hook is called in my plugin before even parse_query was executed and that’s why it doesn’t work.

    Any idea how I can make this work?

    <?php
    /*
    Plugin Name: Tweak
    Plugin URI: http://wordpress.org/extend/plugins/hello-dolly/
    Description: Little tweak
    Author: Mmmkay
    Version: 0.1
    Author URI: http://nonono.com
    */
    
    function parse_query( $wp_query ) {
    
    		$wp_query->set( 'post_type', 'post' );
    
    	}
    
    add_action( 'parse_query', array( &$this, 'parse_query' ) );
  • The topic ‘Hooking into parse_query too early?’ is closed to new replies.