WordPress.org

Ready to get started?Download WordPress

Forums

Hooking into parse_query too early? (1 post)

  1. mmmkay
    Member
    Posted 2 years ago #

    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' ) );

Topic Closed

This topic has been closed to new replies.

About this Topic