Skip to content

Instantly share code, notes, and snippets.

@blogjunkie
Created October 17, 2025 10:35
Show Gist options
  • Select an option

  • Save blogjunkie/8e590af66532a14a3fe090ca44122f8b to your computer and use it in GitHub Desktop.

Select an option

Save blogjunkie/8e590af66532a14a3fe090ca44122f8b to your computer and use it in GitHub Desktop.
Bulletproof check for page built with Elementor
<?php // Don't copy this line
$post_id = get_queried_object_id();
$is_elementor = false;
if ( function_exists('did_action') && did_action('elementor/loaded') ) { // Check if Elementor is loaded
$is_elementor = \Elementor\Plugin::instance()->db->is_built_with_elementor( $post_id );
} else {
// Fallback when Elementor isn't loaded: check post meta flag
$is_elementor = get_post_meta( $post_id, '_elementor_edit_mode', true ) === 'builder';
}
if ( $is_elementor ) {
// Page is built with Elementor
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment