How to make that snippet using (Code Snippet in Wordpress) load only one page, because of home page and other pages loading time.
The code I'm using:
'''add_action( 'init', 'register_uzleteim_endpoint');
/**
* Register New Endpoint.
*
* @return void.
*/
function register_uzleteim_endpoint(){
add_rewrite_endpoint( 'uzleteim', EP_ROOT | EP_PAGES );
}
add_filter( 'query_vars', 'uzleteim_query_vars' );
/**
* Add new query var.
*
* @param array $vars vars.
*
* @return array An array of items.
*/
function uzleteim_query_vars( $vars ) {
$vars[] = 'uzleteim';
return $vars;
}
add_filter( 'woocommerce_account_menu_items', 'add_uzleteim_tab' );
/**
* Add New tab in my account page.
*
* @param array $items myaccount Items.
*
* @return array Items including New tab.
*/
function add_uzleteim_tab( $items ) {
$items['uzleteim'] = 'Üzleteim';
return $items;
}
add_action( 'woocommerce_account_uzleteim_endpoint', 'add_uzleteim_content' );
/**
* Add content to the new tab.
*
* @return string.
*/
function add_uzleteim_content() {}
I'm already tried something like this:
add_action( 'wp_footer', function () {
if ( ! is_page( array( 42, 'Page Name', 'about-us', 968 ) ) ) return;
// rest of snippet code here
} );
But it was not work, cause "unexpected if"