Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump add_filter "do_shortcode" to priority 11, follow core #13

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

lkraav
Copy link

@lkraav lkraav commented Feb 20, 2014

See https://github.com/WordPress/WordPress/blob/3.8.1/wp-includes/shortcodes.php#L388

Because shortcode_unautop() is seriously lacking 1, sufficient cause
exists to replace this function with a custom plugin until core gets
better. Putting everything on priority 10 in GC creates unnecessary
filter ordering problems when replacing built-in shortcode_unautop(),
meaning one would also have to remove and re-add GC's "do_shortcode"
filter, which must always run after "shortcode_unautop". Might as well
do the right thing upstream.

See https://github.com/WordPress/WordPress/blob/3.8.1/wp-includes/shortcodes.php#L388

Because shortcode_unautop() is seriously lacking [1], sufficient cause
exists to replace this function with a custom plugin until core gets
better. Putting everything on priority 10 in GC creates unnecessary
filter ordering problems when replacing built-in shortcode_unautop(),
meaning one would also have to remove and re-add GC's "do_shortcode"
filter, which must always run after "shortcode_unautop". Might as well
do the right thing upstream.

[1]: http://core.trac.wordpress.org/ticket/14050
@justintadlock
Copy link
Owner

I don't really see how this patch will help anything in any way. I could see an argument for something like this:

add_filter( 'gc_column_content', 'wpautop', 5 );
add_filter( 'gc_column_content', 'shortcode_unautop', 10 );
add_filter( 'gc_column_content', 'do_shortcode', 15 );

That would give others better opportunities for hooking in. But, giving do_shortcode a priority of 11 makes no real difference. It's always going to run after shortcode_unautop in the current code:

add_filter( 'gc_column_content', 'wpautop' );
add_filter( 'gc_column_content', 'shortcode_unautop' );
add_filter( 'gc_column_content', 'do_shortcode' );

Am I missing something?

@lkraav
Copy link
Author

lkraav commented Feb 21, 2014

First difference is increased consistency with core.

But primary impulse is, right now I have to do:

remove_filter( "gc_column_content", "shortcode_unautop" );
remove_filter( "gc_column_content", "do_shortcode" ); # without this, "do_shortcode" will move a step up towards "wpautop", and lose correct order with "my_custom_shortcode_unautop"
add_filter( "gc_column_content", "my_custom_shortcode_unautop" );
add_filter( "gc_column_content", "do_shortcode", 11 ); # yes 10 or 11, doesn't really matter but meh, shouldn't have to touch do_shortcode at all

Instead of just doing:

remove_filter( "gc_column_content", "shortcode_unautop" );
add_filter( "gc_column_content", "my_custom_shortcode_unautop" );

What can I say, I like less code.

Other than that, moving all of them to different priorities has a point, too. I just don't know a reason for playing with wpautop() right now and usually go about things step by small step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants