Title: 404 Error
Last modified: May 24, 2018

---

# 404 Error

 *  Resolved [oneminduniv](https://wordpress.org/support/users/oneminduniv/)
 * (@oneminduniv)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/404-error-309/)
 * It appears that when someone tries to access a page that they do not have the
   correct membership for, a 404 error page is displayed.
 * This is not good if you are using a plugin like iThemes Security, that tracks
   404 errors and locks client out after too many 404’s.
 * Is there a way to create a custom redirect to member sign up page or upgrade 
   page vs 404?
 * Thank you

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

 *  [markhf](https://wordpress.org/support/users/markhf/)
 * (@markhf)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/404-error-309/#post-10319961)
 * Hi [@oneminduniv](https://wordpress.org/support/users/oneminduniv/)
 * Please use this filter **wt_user_allowed_posts** along with [this version of the plugin](https://downloads.wordpress.org/plugin/xa-woocommerce-memberships.1.0.1.zip)
   to alter the post array and set your desired post object if the array is empty.
 *  Thread Starter [oneminduniv](https://wordpress.org/support/users/oneminduniv/)
 * (@oneminduniv)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/404-error-309/#post-10323806)
 * Thank you for your reply.
 * RE: Please use this filter wt_user_allowed_posts
 * I do not see additional settings in the new plugin; Would I add the wt_user_allowed_posts
   to the functions.php file or may be create the filter as a plugin?
 * I’m not sure how to write the filter; what I want to do is direct members that
   need to upgrade to access content to a custom upgrade page vs a 404 error. The
   upgrade page will be the same for all memberships.
 * Thank again!
 *  [markhf](https://wordpress.org/support/users/markhf/)
 * (@markhf)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/404-error-309/#post-10324137)
 * Hi [@oneminduniv](https://wordpress.org/support/users/oneminduniv/)
 * You may use the snippet in functions.php like
 *     ```
       add_filters('wt_user_allowed_posts' , 'my_custom_page');
   
       function my_custom_page($posts){
        return array(
   
          20 => // change your custom page id here
   
          get_post(20)
       );
   
       }
       ```
   
 * Please let us know if any issues.
 *  Thread Starter [oneminduniv](https://wordpress.org/support/users/oneminduniv/)
 * (@oneminduniv)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/404-error-309/#post-10329428)
 * Getting PHP errors with the snippet above.
 * Parse error: syntax error, unexpected ‘&’ On line 13
 * When I remove the extra “&” here > add_filters(**'**wt_user_allowed_posts' , **&#
   039**;my_custom_page');
 * I get > (T_STRING), expecting ‘(‘ On line 14`
 * Never mind on the above; I took your code from the WP email that added &#039 
   in place of ‘
    But now that I have the code as you posted above, I’m getting 
   new errors
    -  This reply was modified 7 years, 11 months ago by [oneminduniv](https://wordpress.org/support/users/oneminduniv/).
    -  This reply was modified 7 years, 11 months ago by [oneminduniv](https://wordpress.org/support/users/oneminduniv/).
    -  This reply was modified 7 years, 11 months ago by [oneminduniv](https://wordpress.org/support/users/oneminduniv/).
 *  Thread Starter [oneminduniv](https://wordpress.org/support/users/oneminduniv/)
 * (@oneminduniv)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/404-error-309/#post-10329458)
 * New errors
 * Fatal error: Uncaught Error: Call to undefined function add_filters() in /home/
   www/xxxxxx.com/wp-content/plugins/member-upgrade-notice/member-upgrade-notice.
   php:12 Stack trace: #0 /home/www/xxxxxx.com/wp-admin/includes/plugin.php(1897):
   include() #1 /home/www/xxxxxx.com/wp-admin/plugins.php(172): plugin_sandbox_scrape(‘
   member-upgrade-…’) #2 {main} thrown in /home/www/xxxxxx.com/wp-content/plugins/
   member-upgrade-notice/member-upgrade-notice.php on line 12
 *  [markhf](https://wordpress.org/support/users/markhf/)
 * (@markhf)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/404-error-309/#post-10330596)
 * Hi [@oneminduniv](https://wordpress.org/support/users/oneminduniv/)
 * That error is coming from the plugin “member-upgrade-notice”. Please check by
   disabling that to confirm.
 *  Thread Starter [oneminduniv](https://wordpress.org/support/users/oneminduniv/)
 * (@oneminduniv)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/404-error-309/#post-10332367)
 * RE: That error is coming from the plugin “member-upgrade-notice”
 * Yes, I created a plugin (vs adding code to functions.php) using your code from
   above, I just named the plugin member-upgrade-notice;
 *     ```
       add_filters('wt_user_allowed_posts' , 'my_custom_page');
   
       function my_custom_page($posts){
        return array(
   
          20 => // change your custom page id here
   
          get_post(20)
       );
   
       }
       ```
   
 * And when I tried to activate the plugin I got the error notice above.
 * I’m not very good with PHP, but I think the function > my_custom_page should 
   be declared before the filter > add_filters(‘wt_user_allowed_posts’ , ‘my_custom_page’);
 * Thank you
 *  [markhf](https://wordpress.org/support/users/markhf/)
 * (@markhf)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/404-error-309/#post-10335150)
 * Hi [@oneminduniv](https://wordpress.org/support/users/oneminduniv/)
 * You can raise a support ticket [here](https://www.webtoffee.com/product/woocommerce-subscriptions/)
   in our support tab. So we can check this in your site.
 *  [markhf](https://wordpress.org/support/users/markhf/)
 * (@markhf)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/404-error-309/#post-10385901)
 * Hi [@oneminduniv](https://wordpress.org/support/users/oneminduniv/)
 * Please check with the latest version of the plugin. There is option to set default
   access denied page.

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

The topic ‘404 Error’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/xa-woocommerce-memberships_1a5eb7.
   svg)
 * [Memberships for WooCommerce](https://wordpress.org/plugins/xa-woocommerce-memberships/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/xa-woocommerce-memberships/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/xa-woocommerce-memberships/)
 * [Active Topics](https://wordpress.org/support/plugin/xa-woocommerce-memberships/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/xa-woocommerce-memberships/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/xa-woocommerce-memberships/reviews/)

 * 9 replies
 * 2 participants
 * Last reply from: [markhf](https://wordpress.org/support/users/markhf/)
 * Last activity: [7 years, 11 months ago](https://wordpress.org/support/topic/404-error-309/#post-10385901)
 * Status: resolved