Skip Navigation

[Resolved] Receive an access error after creating a Type originally created by plugin

This support ticket is created 8 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 4 replies, has 2 voices.

Last updated by laurieH 7 years, 12 months ago.

Assisted by: Shane.

Author
Posts
#375789

HISTORY
https://toolset.com/forums/topic/convert-custom-types-created-by-3rd-party-plugin-without-breaking-plugin-updates/

I am using the LearnDash plugin. LearnDash creates a CPT called sfwd-courses. I am trying to bring sfwd-courses under the control of types in a supported manner that does not break LearnDash plugin updates.

Toolset support LUOY provided me with the following code from the LearnDash plugin:

$this->post_options = apply_filters( 'sfwd_cpt_options', $this->post_options, $this->post_type );
 
register_post_type( $this->post_type, $this->post_options );

When I asked LearnDash support how to use the code they responded with this:

add_filter("sfwd_cpt_options", function($post_options, $post_type) { 
return null; 
}, 10, 2); 

When add add the above to functions.php and deactivate LearnDash I am able to create the CPT with Types. When I browse to course I receive the following message:
You are not allowed to edit posts in this post type.

QUESTION 1
I am unclear what the intended result of the code below is supposed to be. Is it used to un-register the the CPT? Is it used to add a custom field to sfwd-courses? In either case I imagine I need to replace the variables with actual values. I've tried to do this and failed miserably. Please provide me with a snippet I can copy directly to my child theme's functions.php with information about exactly what the snippet is doing.

add_filter("sfwd_cpt_options", function($post_options, $post_type) { 
return null; 
}, 10, 2); 

QUESTION 2
In my initial request LUOY stated that I shouldn't try to bring LearnDash CPTs under the control of Types because I would no longer be able to update LearnDash (hopefully I am interpreting his response correctly!) Why is this? Types operates on default post types without issue. ACF appears to work on CPTs created by other plugins naturally. I purchased the entire Toolset over 60 days ago and have not been able to integrate it with LearnDash making it totally useless to me and I'm now outside of the refund period.

To make my question more clear "Is there really not a supported method of integrating LearnDash Courses with Types?"

#375931

I think I may have solved the problem, but please confirm that you don't see any issues with what I've done!

1. Deleted (emptied trash) for all items in Courses
2. Disabled all plugins except Types (overkill)
3. Created a new post type with slug of sfwd-courses
4. Enabled all plugins

I could have continued with Step 2 found here: https://toolset.com/faq/how-do-i-convert-existing-custom-types-and-fields-to-types-control/, but decided it wasn't necessary to have control over the existing fields. Step 2 is written for an older version of the UI. I found it under Types -> Post Fields. Add field, then select choose from existing.

Result:
Courses are displayed in the admin menu exactly where they belong, under LearnDash. The Course Post Type is present and editable in Types. I was able to add a field group and custom field.

*** Absolutely nothing was touched in LearnDash or my theme files. I did not complete Step 1 in the above article.

#375937

Clarification of my last post.

Using this article: https://toolset.com/faq/how-do-i-convert-existing-custom-types-and-fields-to-types-control/

Converting custom post types and taxonomy
Skipped step 1, completed step 2.

Converting custom fields
Steps 1 and 2 work almost exactly as written! There is a button there, but it is not called Control Custom Fields. Look for Post Field Control at the bottom of the Post Fields page.

Hope this helps someone - it's sure been driving me nutz!

#376199

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Laurie,

I must sincerely apologise for the extreme length in delay of my first response 🙁

This is not something that regularly happens so I hope you understand.

Taking a look at your issue it seems that you have managed to get it resolved.

Also I noticed that you were able to resolve this issue with the plugin author's help.

One thing is that I believe this would work if you had disabled the learndash plugin and recreate the custom post type in Types and then re-enable the LearnDash.

Thanks,
Shane

#379468

Thank you. That's exactly what I ended up doing.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.