How disable wp-json of tribe events?

Home Forums Calendar Products Events Calendar PRO How disable wp-json of tribe events?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1336347
    Gabriel
    Participant

    Hello,

    My site is getting slow and we are investigating causes.

    Currently our home: https://www.titanesmedellin.com/ has 4 Tribe Events ShortCodes that loads the basic info of 4 events.

    Evaluating our home with https://tools.pingdom.com/ appears very slow files, both with this call:
    – x-tec-api-root > https://www.titanesmedellin.com/wp-json/tribe/events/v1/

    We are thinking that wp-json is slowing our site so we want disable with “Disable REST API” plugin.
    If we do it, the Tribe Events Shortcodes will ge the events info directly from database?

    Thanks

    #1337161
    Victor
    Member

    Hola Gabriel!

    Thanks for reaching out to us!

    I’m really sorry you are experiencing performance issues. I know for myself they can be really hard to tackle, so I really sympathise with this.

    We have a great article that will get you started on Performance Considerations you should know about. After that, if you decide to implement a caching system then you can move to these articles: Caching: What, when and how and Caching month view HTML in transients

    Finally, there is a good article George put up here that groups a set of developer plugins. It’s a bit more technical than the others but will definitely be of help if you are into development.

    We are thinking that wp-json is slowing our site so we want disable with “Disable REST API” plugin.
    If we do it, the Tribe Events Shortcodes will ge the events info directly from database?

    I’m not really sure about this fact. I will reach out to the team to have a second opinion on this topic and will get back to you with a more solid answer.

    Please hang in there.

    Thanks,
    Victor

    #1337703
    Gabriel
    Participant

    ok.. Thanksss!!

    #1338078
    Victor
    Member

    Hi Gabriel!

    Thanks for your patience.

    If you disable the REST API, the tribe events shortcodes should still work.

    You can use the following code to disable The Events Calendar’s REST API functionality:

    * Note that trying to import events from a site with the REST API disabled...
     * into another site running The Events Calendar... via Event Aggregator...
     * will cause this import setup/scheme to no longer function, since
     * Event Aggregator uses the REST API to pull events from one TEC site
     * into another TEC site.
    // advertise to the world that the REST API is disabled
    add_filter( 'tribe_events_rest_api_enabled', '__return_false' );
    // actually disable REST API functionality
    add_action( 'init', function () { 
    remove_action(
    'rest_api_init',
    array( tribe( 'tec.rest-v1.main' ), 'register_endpoints' )
     );
    }, 5 );

    I hope that helps! Let me know if you have other questions.

    Best,
    Victor

    #1339593
    Gabriel
    Participant

    Hello.. Where I add this code?
    Thanks!

    #1339680
    Victor
    Member

    Hi Gabriel!

    I’m sorry I wasn’t clear enough. You can add this code in your active theme’s functions.php file.

    Let me know if it works for you.

    Best,
    Victor

    #1349783
    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 7 posts - 1 through 7 (of 7 total)
  • The topic ‘How disable wp-json of tribe events?’ is closed to new replies.