pods-framework/pods-export-code

Export to register_post_type and register_taxonomy

szepeviktor opened this issue · 9 comments

Sometimes I use Pods to generate parameters (PHP code) for register_post_type() and register_taxonomy(). Then Pods will be disabled.

https://github.com/szepeviktor/wordpress-plugin-construction/blob/master/mu-pods-register-export/pods-register-export.php

Needs a one-line modification!

What modification was that exactly? Happy to bring your tweak over here.

Thanks.
var_export instead of var_dump in pods_debug() to make it reversible.

I know I could go pods_api()->load_pods... but it would need a big chunk of copy of the Pods plugin.

Where are you calling pods_debug() in that code?

Oh nevermind, I see now it's via the pods_debug_register param flag

Nowhere! 😄
Its output is caught and reversed (eval-ed) into PHP arrays.

I would rewrite it if you give me instructions that will end up in under 100 lines of code.

I think what you came up with is clever, but this PR should make it easier to do what you want:

pods-framework/pods#4498

In Pods 2.7, you can hook into the pods_register_taxonomy and pods_register_post_type filters to collect all of the registrations that you'd like, the you can rebuild the register_post_type / register_taxonomy statements to use with your own export code easily from there.

I'll add an option to export to register_post_type / register_taxonomy in this Export to Code plugin too.

I'll start the rewrite as it is released on WP.org.

I'll add an option to export to register_post_type / register_taxonomy in this Export to Code plugin too.

Thank you!