User Permissions on custom post type
User Permissions on custom post type
User Permissions on custom post type
By giving each role the edit_others_posts capability, plus allowing each role to edit only one CPT, you actually getting what you want. no need to check anything about other users capabilities this way. Maybe what you’re missing is having a different capability set for each post type. e.g: if you have CPT called books you … Read more
This is what i am using; add_action(‘init’, ‘blockusers_init’); function blockusers_init() { if (is_admin() && !current_user_can(‘administrator’) && !(defined(‘DOING_AJAX’) && DOING_AJAX)) { wp_redirect(home_url()); exit; } } It’s possible the best one. EDIT : You need a custom login page for reach wp-admin. This code redirect to homepage if you enter directly to wp-admin.
Something like this? if(current_user_can(‘administrator’)){ echo ‘<option value=”[email protected]”>[email protected]</option>’; }elseif(current_user_can(‘subscriber’)){ echo ‘<option value=”[email protected]”>[email protected]</option>’; } Maybe this should be wrapped in a user logged in check like this: if(is_user_logged_in()){ if(current_user_can(‘administrator’)){ echo ‘<option value=”[email protected]”>[email protected]</option>’; }elseif(current_user_can(‘subscriber’)){ echo ‘<option value=”[email protected]”>[email protected]</option>’; } }
Since this is custom functionality for a specific theme, you would either need to use custom hooks that the theme author included in the markup for that modal (unlikely), or contact the theme author directly to ask, or create a child theme so you can edit that file without it being overriden when the theme … Read more
There are a couple of options here. One, which I’ve found the easiest, is to move content you want to protect into custom post types. From there, you create specific permissions (capabilities) for each CPT, and WP will automatically only show the content that the current user has permission to edit in the back end. … Read more
Changing a users posts to drafts upon role change
It probably is impossible to do without a specialized plugin. That said, one way to achieve it that comes to my mind would be to write a plugin that would add a custom capability “publish_others_posts”, and then in all the places where the “publish_posts” capability is checked, replace it with a check for “publish_posts” if … Read more
did you try to use a plugin instead, https://premium.wpmudev.org/forums/topic/configure-single-sign-on-for-multiple-wordpress-sites-and-make-it-secure have a look at this and this one https://wordpress.org/plugins/wp-multisite-sso/ hope this might help
All functions place in functions.php of your theme. And create redirect on template_redirect hook. add_action(‘template_redirect’, ‘make_redirect’); function make_redirect() { if ( ! is_admin() && ! current_user_can( ‘administrator’ ) ) { wp_redirect( ‘https://google.com’ ); } }