Disable required validation for specific post type (page-generator-pro)

Support General Disable required validation for specific post type (page-generator-pro)

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #41283
    SkryptSkrypt
    Participant

    I want to use WPZinc Page Generator Pro (PGP) and I'm running into the following problem:

    PGP uses the post type 'page-generator-pro', on which there's a custom field 'type' which specifies the post type of the pages that the plugin generates. They've created a Meta Box integration, which just adds all custom fields from Meta Box to the 'page-generator-pro' post edit screen. This is messy, but it works fine, except for one small detail. When I select 'page' as the 'type' of my 'page-generator-pro' post, I still have to fill in all the required custom fields from the post types besides 'page' (for example: also the required fields for the 'post' post type). This creates a lot of extra work for the user and extra irrelevant data in the database. I've thought of either one of the following two solutions, but I'm not sure whether this is possible from the Meta Box perspective (/ through the Meta Box actions):

    1) Disable field validation through the 'rwmb_before_save_post' action hook when the post type is 'page-generator-pro'.

    2) Only display the custom fields for the selected post type ('type') by editing the Meta Box integration from PGP. I've already been checking out the Meta Box integration source code and was able to implement this. However, when changing the 'type' after initially creating the 'page-generator-pro' post, you still get a validation error because Meta Box wants to validate the required custom fields from the previous 'type' (as the actual post type doesn't change).

    I've already reached out to PGP to see if they can come up with a possible solution, but maybe someone over here knows how to solve this. Thanks!

    #41294
    PeterPeter
    Moderator

    Hello there,

    You can try to use the filter rwmb_normalize_field to change the field settings on your own. Please read more in the documentation https://docs.metabox.io/filters/rwmb-normalize-field/

    If it does not work, please contact the plugin PGP support to get further assistance.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.