chnm / anthologize

Anthologize is a free, open-source, WordPress-based platform for publishing. Grab posts from your WordPress blog, pull in feeds from external sites, or create new content directly in Anthologize. Then outline, order, and edit your work, crafting it into a coherent volume for export in several formats, including PDF, EPUB, and TEI.
http://anthologize.org
GNU General Public License v3.0
174 stars 29 forks source link

apply_filters( 'init' ) is killing output #43

Open patrickmj opened 12 years ago

patrickmj commented 12 years ago

Imported from Trac ticket #119 reported by boonebgorges on 2011-03-12:

Hey Patrick -

On the latest revs of the 0.5 branch, I'm finding that I can't output anything (I get white screens, with - strangely - nothing in my error log). I traced it to https://github.com/chnm/anthologize/blob/0.5-branch/includes/class-tei-dom.php#L32 as applied in https://github.com/chnm/anthologize/commit/f1c627260f85818d742a1f744baa9b58a922c5f4

I don't think this is a syntactically correct use of apply_filters() http://codex.wordpress.org/Function_Reference/apply_filters What are you trying to do here? Are you trying to get some portion of WP to load? Or some subset of WP's default filters to be applied?

FWIW, you might not have seen this on your own installation because you aren't running any other plugins. Lots of things hook to 'init', so in a real life situation there could be conflicts.

patrickmj commented 12 years ago

I think this should go into a broader bucket of issues related to how TeiDom gets built, and calls for much smarter use of WP filters during that process.

boonebgorges commented 12 years ago

I think that, at least in this case, the problem may relate to the fact that @apply_filters( 'init' ); is not proper syntax. (I think the @-sign only serves to suppress the error messages in testing environments.) See http://codex.wordpress.org/Function_Reference/apply_filters

'init' is a WP action that is run in the process of loading the WP codebase http://core.trac.wordpress.org/browser/tags/3.2.1/wp-settings.php#L295; arbitrary functions can be hooked to init by using apply_filters(). The problem in #46 is slightly different.