Skip to content

Instantly share code, notes, and snippets.

@hiranthi
Created March 13, 2019 11:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hiranthi/28a05836bfb4d8451490108f9c7f6ea2 to your computer and use it in GitHub Desktop.
Save hiranthi/28a05836bfb4d8451490108f9c7f6ea2 to your computer and use it in GitHub Desktop.
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