Created
March 13, 2019 11:03
-
-
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 :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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