• Resolved Bobkata

    (@bobkata)


    Can I declare wildcards in bewol code to run snipets only if URL contain e.g. if page adress contain page_slug
    and how to do it thank you very much

    if ( ! is_page( ‘page_slug’ ) ) return;

Viewing 1 replies (of 1 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    Hi @bobkata,

    You should be able to check this by accessing the WP_Page object directly with the get_queried_object function, and then using str_contains to test directly against the page slug:

    $page = get_queried_object();
    
    if ( ! $page || ! is_page() || ! str_contains( $page->post_name, 'page_slug' ) ) {
    	return;
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Wildcards for url’ is closed to new replies.