Support

Home Forums Event Espresso Premium Fatal error: Call to a member function is_espresso_page() on a non-object

Fatal error: Call to a member function is_espresso_page() on a non-object

Posted: October 24, 2014 at 10:04 am


Zoe E

October 24, 2014 at 10:04 am

I am creating a plugin whichg will take the events and allow them to be exported in a xls file format.

Issues is when i do a wp_query on the post type espresso_events it is failing and given me this error.
Fatal error: Call to a member function is_espresso_page() on a non-object in /home/sites/epixdev1.co.uk/public_html/hostworld/wp-content/plugins/event-espresso-core-reg/core/CPTs/EE_CPT_Strategy.core.php on line 337

Why is this? but if i change it to post to get nomal posts it works fins he the code i am using:

    $args = array(
                                'post_type' => 'espresso_events',
                        );
$wpevents = new WP_Query( $args );

    //must start at second row!
    $i = 2;

    while ($wpevents->have_posts()) : $wpevents->the_post();
        $postid = get_the_ID();
        $posttitle = get_the_title();
        $objPHPExcel->getActiveSheet()->setCellValue('A' . $i, $postid)
	                              ->setCellValue('B' . $i, $posttitle);
        $i++; 

    endwhile; 

Like i said this code works when i change post type to post.

Any idea why this is failing?

Many Thanks.


Josh

  • Support Staff

October 24, 2014 at 11:23 am

Hi Zoe,

I don’t know, the same code isn’t throwing the same error for me. You could try either of these:

1) Add 'suppress_filters'=>false, to the $args array
2) change $wpevents = new WP_Query( $args ); to $wpevents = new EE_Event_List_Query( $args );

The support post ‘Fatal error: Call to a member function is_espresso_page() on a non-object’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso