Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter sethadam1

    (@sethadam1)

    Stupid mistake of the day leaving it up for anyone else goofy enough to make this mistake:

    All pages broken:

    add_action('pre_get_posts','myfunc');
    function myfunc($query) {
    	if ( $query->is_main_query() ) {
    		if(!is_admin()) { $query->set('post_type', array( 'post', 'podcast' ) ); }
    	}
    }

    All pages magically UNbroken:

    add_action('pre_get_posts','myfunc');
    function myfunc($query) {
    	if ( $query->is_main_query() ) {
    		if(!is_admin()) { $query->set('post_type', array( 'page', 'post', 'podcast' ) ); }
    	}
    }

    When you load a page, it fires the pre_get_posts action, which is odd, because you’d expect fetching a single post not to fire pre_get_posts, but it does.

    So… mystery solved.

    Thread Starter sethadam1

    (@sethadam1)

    I tracked it down to this line:

    add_action('pre_get_posts','myfunc');

    Commenting that out worked. With that line in my plugin, no “page” post_type will load – just “page” types, no others are affected. I mean… that’s weird, right?

    Thread Starter sethadam1

    (@sethadam1)

    Oddly enough, it was a plugin… one that *I* wrote for the site… that worked for the last week without an issue. I’m not sure what could cause it to suddenly break, but I’ll update if/when I figure it out.

    No, no one knows how to resolve, because it’s not enough info.

    Is your server properly configured to send CSS as text/css?
    Is the CSS file present?
    Does it work in other browsers?

    Let us know.

Viewing 4 replies - 1 through 4 (of 4 total)