Changing event page title archives to Upcoming Events

Home Forums Calendar Products Events Calendar PRO Changing event page title archives to Upcoming Events

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1434931
    Claire Brunner
    Participant

    There is a piece of code that seems might have just broke with the latest WP version. I had applied the below code from your codex:

    // Prevent Yoast from changing Event Title Tags for Event Views (Month, List, Etc,)
    add_action( 'pre_get_posts', 'tribe_remove_wpseo_title_rewrite', 20 );
    function tribe_remove_wpseo_title_rewrite() {
    if ( class_exists( 'Tribe__Events__Main' ) && class_exists( 'Tribe__Events__Pro__Main' ) ) {
    if( tribe_is_month() || tribe_is_upcoming() || tribe_is_past() || tribe_is_day() || tribe_is_map() || tribe_is_photo() || tribe_is_week() ) {
    $wpseo_front = WPSEO_Frontend::get_instance();
    remove_filter( 'wp_title', array( $wpseo_front, 'title' ), 15 );
    remove_filter( 'pre_get_document_title', array( $wpseo_front, 'title' ), 15 );
    }
    } elseif ( class_exists( 'Tribe__Events__Main' ) && !class_exists( 'Tribe__Events__Pro__Main' ) ) {
    if( tribe_is_month() || tribe_is_upcoming() || tribe_is_past() || tribe_is_day() ) {
    $wpseo_front = WPSEO_Frontend::get_instance();
    remove_filter( 'wp_title', array( $wpseo_front, 'title' ), 15 );
    remove_filter( 'pre_get_document_title', array( $wpseo_front, 'title' ), 15 );
    }
    }
    };

    Since the WP update, I receive this error:


    Uncaught Error: Call to undefined function tribe_is_month() in /srv/bindings/a331c53837bf4c9c8a695623a5063ec1/code/wp-content/plugins/constitutional-functions/constitutional-functions.php:581
    Stack trace:
    #0 /srv/bindings/a331c53837bf4c9c8a695623a5063ec1/code/wp-includes/class-wp-hook.php(286): tribe_remove_wpseo_title_rewrite(Object(WP_Query))
    #1 /srv/bindings/a331c53837bf4c9c8a695623a5063ec1/code/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(Object(WP_Query), Array)
    #2 /srv/bindings/a331c53837bf4c9c8a695623a5063ec1/code/wp-includes/plugin.php(515): WP_Hook->do_action(Array)
    #3 /srv/bindings/a331c53837bf4c9c8a695623a5063ec1/code/wp-includes/class-wp-query.php(1634): do_action_ref_array('pre_get_posts', Array)
    #4 /srv/bindings/a331c53837bf4c9c8a695623a5063ec1/code/wp-includes/class-wp-query.php(3222): WP_Query->get_posts()
    #5 /srv/bindings/a331c53837bf4c9c8a695623a5063ec1/code/wp-includes/post.php(1704): WP_Query->query(Array)
    #6 /srv/bindings/a331c53837bf4c9c8a695623a5063

    This takes error takes down my site. Any suggestions to fix this? I need to reapply the code so the page title of events is back to Upcoming Events.

    FYI, I have switched themes (I use a custom theme I developed) to TwentySeventeen and disabled other plugins with no change.

    #1436343
    Victor
    Member

    Hi There!

    Thanks for getting in touch with us. Let me help you with that issue.

    I could not reproduce the issue you are having with that snippet. From the error log it seems the code snippet might be being triggered inside a plugin called constitutional functions. Could you please verify this?

    Please make sure you are adding the code into your theme’s functions.php and nowhere else to see if any difference.

    When coming back, please share with us your system information by following this guide > https://theeventscalendar.com/knowledgebase/sharing-sys-info/. We’ll see if there is anything strange that would indicate an error from there.

    Please let me know about it.

    Thanks,
    Victor

    #1455412
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Changing event page title archives to Upcoming Events’ is closed to new replies.