Feature Requests

Got an idea for a new feature or integration? We’d love to hear it! You can find our roadmap here.

3 votes

Add WPF settings page to protect all posts of a type

Objective is to be able to globally apply access rules to specified post types. For example, maybe there is a CPT defined as “bonuses”. I would like to be able to define WPF access rules to apply to all of that post type.

It would be similar to the integration done with the Custom Post Type UI plugin (https://wordpress.org/plugins/custom-post-type-ui/) or with the WPF filter wpf_post_type_rules .

My proposal would be to have a tab added to the WPF Settings page called something like “Post Type Protection”. On that settings tab would be listed all the registered post types (standard and CPT) along with the settings dialogs for each post type to define access conditions. Basically, putting a user interface to wpf_post_type_rules .

By doing this I think protection logic can be applied to any CPT independent of the tool used to create the CPT (e.g. ACF, PODS, etc)

Completed Category: Plugin Integration Enhancements Norm Sash shared this idea Updated: February 5, 2024

2 thoughts on “Add WPF settings page to protect all posts of a type”

  1. We would prefer to discourage this because it’s bad for performance….

    At the moment, on every pageload, maybe 1 to 10 post IDs are checked for access.

    That’s because there’s not just the main content, but also any menu items, widgets, any other “related” content on the page needs to be checked.

    That number can go up quite a bit if Filter Queries, Hide From Menus, or archive / category / term-based protections are enabled, as well.

    For each post ID in a request, WPF has to check the wpf-settings meta key in the database. So that’s 1 database hit per post.

    Once you add *any* post type rule (even just one), now we can’t display anything without also checking the post type of every queried object.

    That means we need to get_post() on the post ID, and load that post to check its type.

    That turns the 1 to 10 queries into 2 to 20 queries. In cases where you’re using Filter Queries (or other features) that can turn 100 queries into 200, and cause some serious performance problems.

    My fear is that if we add a tab like that to the WPF settings, many folks will enable post-type level protection on content that’s already protected by other plugins (i.e. Lessons), thinking, “Why not be extra protected?”, and unknowingly double their database queries on every pageload.

    So….. that’s why it’s developer only / requires another plugin for the time being, until we can think of a way to do it without affecting performance. I’d prefer people to have to work a bit and understand the implications before enabling that feature.

    Hope that makes sense.

Leave a Reply to Jack Arturo Cancel Reply

Your email address will not be published. Required fields are marked *

Powered by Simple feature Requests