How to remove the extra fields in the events calendar

The Events Calendar

Requirements:

  • The events calendar plugin installed (not necessary pro)
  • Knowledge in PHP
  • Functions.php

In this tutorial I will teach you how to disable the extra field at the backend of your events post.

  1. Go to your functions.php file
  2. Copy and Paste the code below
add_filter( 'tribe_events_editor_default_template', function( $template ) {
    // collect an array of template values, like "tribe/event-price" and tribe/event-venue"
    $template_search = array_column( $template, 0 );
 
    // Get the index of the "tribe/event-price"
    $organizer = array_search( "tribe/event-organizer", $template_search );
 
    // @link: https://www.php.net/manual/en/function.array-splice.php
    
    array_splice(
        // The original $template array
        $template,
        // The integer value of the price index (such as 2)
        $organizer,
        // How many items we want to remove from $template (just 1: the price)
        1
    );


 
    // Return the price-spliced $template
    return $template;
}, 11, 1 );

Leave a Reply

Your email address will not be published. Required fields are marked *