How to remove "meta, link & scripts" from "wp_head" on custom page template

Home Forums Calendar Products Events Calendar PRO How to remove "meta, link & scripts" from "wp_head" on custom page template

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1320236
    Brent Kozlowski
    Participant

    How do I prevent the following from showing in wp_head on my custom page template?

    <meta name="tec-api-version" content="v1"><meta name="tec-api-origin" content="http://localhost/sister"><link rel="https://theeventscalendar.com" href="http://localhost/sister/wp-json/tribe/events/v1/" />

    <script>
    		( function ( body ) {
    			'use strict';
    			body.className = body.className.replace( /\btribe-no-js\b/, 'tribe-js' );
    		} )( document.body );
    		</script>
    		<script type='text/javascript'> /* <![CDATA[ */var tribe_l10n_datatables = {"aria":{"sort_ascending":": activate to sort column ascending","sort_descending":": activate to sort column descending"},"length_menu":"Show _MENU_ entries","empty_table":"No data available in table","info":"Showing _START_ to _END_ of _TOTAL_ entries","info_empty":"Showing 0 to 0 of 0 entries","info_filtered":"(filtered from _MAX_ total entries)","zero_records":"No matching records found","search":"Search:","pagination":{"all":"All","next":"Next","previous":"Previous"},"select":{"rows":{"0":"","_":": Selected %d rows","1":": Selected 1 row"}},"datepicker":{"dayNames":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"dayNamesShort":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"dayNamesMin":["S","M","T","W","T","F","S"],"monthNames":["January","February","March","April","May","June","July","August","September","October","November","December"],"monthNamesShort":["January","February","March","April","May","June","July","August","September","October","November","December"],"nextText":"Next","prevText":"Prev","currentText":"Today","closeText":"Done"}};/* ]]> */ </script>
    • This topic was modified 6 years, 9 months ago by Brent Kozlowski.
    • This topic was modified 6 years, 9 months ago by Andras.
    #1320756
    Andras
    Keymaster

    Hi bkowlowski,

    Thanks for reaching out!

    I have to ask for some time until I get some help for most of that.

    Meanwhile this snippet should help you remove part of that script:

    if ( class_exists( 'Tribe__Main' ) ) {
    remove_action( 'wp_footer', array( Tribe__Main::instance(), 'toggle_js_class' ) );
    }

    I’ll be in touch as soon as I have something.

    Cheers,
    Andras

    #1320763
    Andras
    Keymaster

    Here’s one more:

    if ( function_exists( 'tribe' ) ) {
    remove_action( 'wp_head', array( tribe( 'tec.rest-v1.headers' ), 'add_header' ) );
    }

    Check these and let me know how it works out!

    Cheers,
    Andras

    #1320855
    Brent Kozlowski
    Participant

    Thanks! Those both worked, but still need something to remove this one from the footer.

    <script type='text/javascript'> /* <![CDATA[ */var tribe_l10n_datatables = {"aria":{"sort_ascending":": activate to sort column ascending","sort_descending":": activate to sort column descending"},"length_menu":"Show _MENU_ entries","empty_table":"No data available in table","info":"Showing _START_ to _END_ of _TOTAL_ entries","info_empty":"Showing 0 to 0 of 0 entries","info_filtered":"(filtered from _MAX_ total entries)","zero_records":"No matching records found","search":"Search:","pagination":{"all":"All","next":"Next","previous":"Previous"},"select":{"rows":{"0":"","_":": Selected %d rows","1":": Selected 1 row"}},"datepicker":{"dayNames":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"dayNamesShort":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"dayNamesMin":["S","M","T","W","T","F","S"],"monthNames":["January","February","March","April","May","June","July","August","September","October","November","December"],"monthNamesShort":["January","February","March","April","May","June","July","August","September","October","November","December"],"nextText":"Next","prevText":"Prev","currentText":"Today","closeText":"Done"}};/* ]]> */ </script>

    #1321182
    Andras
    Keymaster

    I managed to get a dev to take a look at this.

    While there is no great way to remove this you can do it with this snippet:

    add_action( 'init', function() {
    if ( function_exists( 'tribe' ) ) {
    remove_action( 'wp_footer', array( tribe( 'tribe.asset.data' ), 'render_json' ) );
    }
    } );

    Please note though that a number of our scripts depend on that data, so removing this has the potential to cause breakages.

    Cheers,
    Andras

    #1321400
    Brent Kozlowski
    Participant

    Thanks!. This is only for a custom landing page template that needs to be super fast. Can’t have anything unnecessary loading that isn’t critical to that page.

    #1322059
    Andras
    Keymaster

    Glad it helps!

    Since this is marked resolved I am going to close this ticket, but if you need anything else related to this topic or another please post a new one in the forum and we will be happy to help you out.

    Good luck with your project!

    Cheers,
    Andras

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘How to remove "meta, link & scripts" from "wp_head" on custom page template’ is closed to new replies.