• Resolved haha taduko

    (@shimodar)


    Hi there,

    I use this plugin finely, but I just confronted with big matter.

    I want to change post_type registration such

    This:
    add_action( ‘init’, ‘create_post_type’);

    To:
    add_action( ‘init’, ‘create_post_type’, 1 );

    As I’m totally PHP novice, so I really want to know the safe manner of it with future plugin update compatibility.

    Thank you ahead for this great community.

    https://wordpress.org/plugins/custom-post-type-ui/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    I have to ask the intent for this, as I know I purposely didn’t put such high priority on the action, but do potentially need to return it back to the default 10 priority instead of 11.

    I can’t say I have plans to make that part customizable either, to be honest.

    Thread Starter haha taduko

    (@shimodar)

    Dear Mr.Michael Beckwith

    Thank you for the quick reply.

    I use Visual Composer plugin in one of my projects, then Visual Composer has a widget which retrieve post and page also compatible with post type.

    But when I set up unique post type on CPT UI, there were nothing the post type name in the VC widget setting.

    I asked VC support staff then he told me that amendment must work so.

    I know this is very rare case and It’s not your plugin’s bug at all.

    But I just expect I have both functionality make sense.

    Sorry this messy sentence coz I’m know English speaker,,bad english.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Yeah, not sure why that occurs and I don’t have a copy of visual editor to work with. Why they need them so early is beyond my understanding.

    I haven’t tested at all, but I do wonder. You could theoretically copy what I have in the cptui_create_custom_post_types function, and do it yourself on your own priority. I would think that would make the widget’s settings available etc, while allowing our version of the registration function to run on its own and just recreate the same exactly.

    Thread Starter haha taduko

    (@shimodar)

    Thank you Mr.Michael.

    Actually I’m not good at English reading, so I might misunderstand the VC support staff could let me know as below,

    Most likely the CPT UI plugin is using a function like following:

    add_action( ‘init’, ‘create_post_type’);

    to register the post type. Change it to:

    add_action( ‘init’, ‘create_post_type’, 1 );

    and the post type will be displayed fine in the data source drop-down.
    You can ask the CPT UI plugin author for the exact location of the above code. Kindly check.

    Thank you,

    And I could adjust this both function works well on the basis of your advice.

    I change the code line 95

    Before:
    add_action( ‘init’, ‘cptui_create_custom_post_types’, 11 ); //Priority 11 so that the taxonomies are registered first.

    After:
    add_action( ‘init’, ‘cptui_create_custom_post_types’, 9 ); //Priority 11 so that the taxonomies are registered first.

    the priority 10 didn’t work, then I gradually put priority little by little.

    As I am PHP novice, so I decided to attach the priority on this code not so much like as 1.

    It looks work for know.

    I’m really apreciated with your advice.

    Thank you.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Looks fine to me. I know I have 1.0.6 planned in the near future that will put the priority at 10 again for everyone, so you’ll need to re-edit that spot later on. Why they need the post types registered so early, I’ll never fully understand, but that’s a different thread.

    Thread Starter haha taduko

    (@shimodar)

    Dear Michael Beckwith

    Thank you so much again.

    Yes! It was something VC matter, and I respect your design policy of this plugin.

    Hi Michael,

    I got the same problem, I tried to change the priority, but it still doesn’t appear.

    Got any ideas?

    Regards Marc

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How to change the registration of "create_post_type setting"’ is closed to new replies.