Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Redirect Editors & Authors from the 'edit page' page to the Elementor editor. Helps keeping the Elementor-stuff intact :)
<?php
function onx_redirect_edit_page_to_elementor()
{
global $post, $pagenow;
if ( ! isset( $post->ID ) || current_user_can( 'manage_options' ) ) return;
if ( ( ( $pagenow == 'post.php' ) && ( get_post_type() == 'page' ) ) && ( current_user_can( 'editor' ) || current_user_can( 'author' ) ) )
{
wp_redirect( sprintf( '/wp-admin/post.php?post=%d&action=elementor', $post->ID ) );
exit;
}
} // end
add_action( 'admin_enqueue_scripts', 'onx_redirect_edit_page_to_elementor', 0 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.