Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'wp_loaded', '_custom_wp_loaded', 99 ) ;
- function _custom_wp_loaded()
- {
- global $wpdb;
- // Get the current URL path (strip the domain and query string)
- $request_uri = $_SERVER['REQUEST_URI'];
- $slug = trim($request_uri, '/'); // Remove leading and trailing slashes
- // Check if the slug exists in the database
- $page_id = $wpdb->get_var( $wpdb->prepare( "
- SELECT ID
- FROM $wpdb->posts
- WHERE post_name = %s
- AND post_type = 'page'
- AND post_status = 'publish'
- ", $slug ) );
- // If a match is found, $page_id will be the ID of the page, otherwise, it will be null.
- if ( $page_id )
- {
- // The current page slug matches
- global $WooGC;
- $WooGC->functions->remove_anonymous_object_filter( 'switch_blog', 'WooGC_general_filters', 'switch_blog' );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement