Home›Topic Tag: Controlling access to front-end content
Topic Tag: Controlling access to front-end content
Access plugin allows you to limit front-end read access to specific pages, posts or custom types and define who will be able to access that content. It also provides the functionality to set access control for specific blocks inside page content, in order to place texts that are visible to or hidden from certain user types.
When you ask for help or report issues, make sure to tell us on which content and user types you are trying to apply access control.
Problem: I have used Access to hide posts from Guest users, but I would can still see post information in search results. I would like to hide this information from Guest users.
Solution: A WordPress Archive is used to display search results. That archive is built in the legacy shortcode version, so you can use Access Control shortcodes in the archive's contents to suppress any visible information. The syntax is as follows:
[toolset_access role="Guest" operator="deny"]
Guests will never see anything inside this shortcode.
[/toolset_access]
If the archive is built using the Blocks Editor, you may use conditional blocks to achieve the same effect.
Problem: I have a custom role that should be able to submit a Form to add or edit a child post, but the parent post options are not shown in the select field in the Form. This was working before a recent update.
Solution: Check your custom code to confirm that redirects set up to block access to the back-end of the site are not applied to admin-ajax.php requests. Add some conditional logic to prevent those redirects as needed, like in the following code example:
/**
* Block wp-admin access for non-admins (not while doing AJAX, see https://toolset.com/forums/topic/custom-role-no-longer-able-to-perform-same-tasks/)
*/
function ace_block_wp_admin() {
if (!current_user_can('edit_users') && ( !defined('DOING_AJAX') || !DOING_AJAX ) ) {
wp_safe_redirect( '/my-account');
exit;
}
}
add_action( 'admin_init', 'ace_block_wp_admin' );
I am using a cred form to allow users to upload media files during the creation and editing of their exhibitor page, the video files are not visible in their media library.
Solution:
You can follow our document to setup user's access to media library, in your case, it needs to setup "Edit own" privilege of post type "Media" for the specific user role.