jjgrainger / PostTypes

Simple WordPress custom post types.
https://posttypes.jjgrainger.co.uk/
MIT License
373 stars 47 forks source link

Add function_exists checks to WP functions #58

Closed JoshuaDoshua closed 2 years ago

JoshuaDoshua commented 4 years ago

When using composer's autoloader, it fails because any WordPress function isn't found. I'd like to add function_exists checks to any method that includes a WordPress functions to resolve this issue.

NOTE: In my case, I'm also autoloading files that call PostTypes registrations. But there shouldn't be any harm in adding these checks.

JoshuaDoshua commented 4 years ago

Alternatively, we could just check ABSPATH at the start of the files like most plugins do

jjgrainger commented 4 years ago

Thanks for the issue.

This library is meant to be used in the context of a WordPress theme/plugin and as such the WordPress functions should be available?

It would be good to get a better idea of the context you're using PostTypes in and how this issue caused before moving forward with a solution.

Thanks!

jjgrainger commented 2 years ago

Closing as I do not see a need for this when the library is intended to be used within a WP environment.

Thanks!