Title: No access &#8211; 404 error
Last modified: January 17, 2017

---

# No access – 404 error

 *  [Deathsin321](https://wordpress.org/support/users/deathsin321/)
 * (@deathsin321)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/no-access-404-error/)
 * I’m using UAM with custom post types. When user dont have access and visit page
   he gets 404 error. How to fix this?

Viewing 11 replies - 1 through 11 (of 11 total)

 *  Plugin Author [gm_alex](https://wordpress.org/support/users/gm_alex/)
 * (@gm_alex)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/no-access-404-error/#post-8663482)
 * If the content is completely hidden that’s the default behavior. 404 means not
   found, which should be the result if something is completely hidden because you
   have no access.
 *  Thread Starter [Deathsin321](https://wordpress.org/support/users/deathsin321/)
 * (@deathsin321)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/no-access-404-error/#post-8677900)
 * But its not.
    When I use UAM on normal post or page its work fine and show “Content
   displayed if user has no access.” When I do same thing for my custom type post
   unlogged user get 404 error. Pls help
 *  Thread Starter [Deathsin321](https://wordpress.org/support/users/deathsin321/)
 * (@deathsin321)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/no-access-404-error/#post-8687054)
 * Still can’t fix it.
 * For normal post and page UAM works fine and show information that content is 
   blocked. But when I check any group in metabox (custom type post) User which 
   dont have access gets 404 error. How to fix this and display information “content
   is blocked” insted 404 page?
 * Pls Help
 *  Plugin Author [gm_alex](https://wordpress.org/support/users/gm_alex/)
 * (@gm_alex)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/no-access-404-error/#post-8687351)
 * For custom post types the hide complete option is the default one, which is currently
   not changeable, it’s only selectable for build in posts and pages. I think I 
   will change that at a future release.
 *  Thread Starter [Deathsin321](https://wordpress.org/support/users/deathsin321/)
 * (@deathsin321)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/no-access-404-error/#post-8687462)
 * Is there any chance for quick fix to make it only work for one custom post type?
 *  Thread Starter [Deathsin321](https://wordpress.org/support/users/deathsin321/)
 * (@deathsin321)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/no-access-404-error/#post-8691208)
 * Or maybe there is easy way to change default settings?
 *  Thread Starter [Deathsin321](https://wordpress.org/support/users/deathsin321/)
 * (@deathsin321)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/no-access-404-error/#post-8705255)
 * Someone help?
 *  [Felipe Viana](https://wordpress.org/support/users/feeh1910/)
 * (@feeh1910)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/no-access-404-error/#post-8706268)
 * My solution was to use this plugin [https://wordpress.org/plugins/members/](https://wordpress.org/plugins/members/)
   for create new roles and restrict content.
    -  This reply was modified 9 years, 4 months ago by [Felipe Viana](https://wordpress.org/support/users/feeh1910/).
 *  Plugin Author [gm_alex](https://wordpress.org/support/users/gm_alex/)
 * (@gm_alex)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/no-access-404-error/#post-8706457)
 * [@deathsin321](https://wordpress.org/support/users/deathsin321/) You have to 
   change the code related to the object type at the config class, see for example:
   [https://github.com/GM-Alex/user-access-manager/blob/master/class/UamConfig.php#L168](https://github.com/GM-Alex/user-access-manager/blob/master/class/UamConfig.php#L168)
 * Check if the object type isn’t a post or a page and if so change it to page or
   post to inherit the behavior of the post or page settings.
 *  Thread Starter [Deathsin321](https://wordpress.org/support/users/deathsin321/)
 * (@deathsin321)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/no-access-404-error/#post-8706621)
 * I think I’m not good enough in php to do this. Can you give me some more advice?
 *  [marctvi](https://wordpress.org/support/users/marctvi/)
 * (@marctvi)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/no-access-404-error/#post-8880497)
 * Can you please address this issue in the next update? I tried to set up a login
   page that catches users trying to access my hidden content, instead of the 404
   page but I cannot avoid the 404 page no matter what settings I select from the
   UAM settings panel.
 * My eventual solution was to add some code to my 404 page template that checks
   the page url for the custom post type slug, if true it shows the login form and
   if false shows the 404 page as it should.
 * See below for those with a similar issue:
 *     ```
       <?php
   
       	$url = $_SERVER['REQUEST_URI'];
   
       	if(strpos($url, 'custom-post-type-slug') == true){
   
       		$args = array(
       			'form_id' => 'loginForm',
       			'label_username' => __( 'Username' ),
       			'label_password' => __( 'Password' ),
       			'label_remember' => __( 'Remember Me' ),
       			'label_log_in' => __( 'Log in to view content' ),
       			'remember' => true
       		);
       		wp_login_form( $args );
   
       	} else if (strpos($url, 'custom-post-type-slug') == false) {
   
       	// 404 page content here
   
       	}
   
       ?>
       ```
   

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘No access – 404 error’ is closed to new replies.

 * ![](https://ps.w.org/user-access-manager/assets/icon.svg?rev=1563783)
 * [User Access Manager](https://wordpress.org/plugins/user-access-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/user-access-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/user-access-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/user-access-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/user-access-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/user-access-manager/reviews/)

 * 11 replies
 * 4 participants
 * Last reply from: [marctvi](https://wordpress.org/support/users/marctvi/)
 * Last activity: [9 years, 3 months ago](https://wordpress.org/support/topic/no-access-404-error/#post-8880497)
 * Status: not resolved