Support » Plugin: WordPress Gallery Plugin - NextGEN Gallery » apply_filters doesn't work with shortcodes.

  • Hi! I updated my 1.9.x branch of NGG to newest version and there is a problem with crossposting to another services (like LiveJournal).

    I use shortcodes in my posts like [singlepic id=943]. Problem is that in crossposted post shortcodes doesn’t change to pictures, I see only text [singlepic id=943].

    Crossposting plugin use the following command:

    apply_filters('the_content', $p->post_content)

    So, it worked with old version NGG and doesn’t work with a new one.

    I try to change code:

    $the_event .= do_shortcode($p->post_content);
    $the_event = apply_filters('ngg_content', $the_event);
    $the_event = apply_filters('the_content', $the_event);

    But it doesn’t processed NGG shortcodes.

    Can you advice me, how to improve apply_filters to convert [singlepic id=943] to html?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author photocrati


    @rotozeev – I suspect this is likely due to a problem with WordPress core (see trac #17817), which unfortunately has been pushed yet again.

    You might see some success by adding the following to your wp-config.php file:

    /** Content shortcode conflicts? */
    define( 'NGG_DISABLE_FILTER_THE_CONTENT', true );

    … or possibly the following to your theme’s functions.php file:

    /** Javascript Conflicts? */
    add_filter( 'run_ngg_resource_manager', '__return_false' );


    – Cais.

    But #17817 made no changes to WordPress 4.3.1, nor to the upcoming WP 4.4. Correct?

    Rotozeev posted the same question to the support threads for the plugin “NextScripts: Social Networks Auto-Poster,” see:

    My mistake, I see now when you say “pushed” you mean “postponed,” not “patch committed.”

    Rotozeev, what plugins do you have active?

    Audio player
    Disqus Comment System
    NextGEN Gallery by Photocrati
    Ozh’ Better Feed
    Primary Feedburner
    Revive Old Post (Former Tweet Old Post)
    Tapatalk for WordPress
    W3 Total Cache
    WP Admin Bar Removal
    WP Missed Schedule
    WP QuickLaTeX
    Yet Another Related Posts Plugin
    Yoast SEO

    also I use JournalPress or NextScripts: Social Networks Auto-Poster or LiveJournal Crossposter for crossposting and all of them has problems with shortcodes of NNG (other shortcodes, for example, [latexpage] working good, old branch of NGG also worked good). There are no problems with shortcodes in post or RSS, only in crossposting plugins and only with new NGG.

    Plugin Author photocrati


    @rotozeev – If this is an issue with how your “cross-posting” plugins are not rendering NextGEN Gallery shortcodes correctly, have you addressed this with those authors as well?

    – Cais.

    That’s a lot of plugins. I guess you have narrowed it down to the two, and know what’s going on. I don’t think I can help you without investing a lot of time. WP is not likely to refactor hooks for a few months now, right?

    One problem is that the_content is both the best and really the worst filter to use generally. It needs guardrails if it’s going to play nice with other plugins. It does get the job done, but only in a limited context. Plugins can get surprised when a widget render triggers it (if I recall correctly).

    And just look at this code in WP core:
    add_filter( 'the_content', 'do_shortcode', 11 ); // AFTER wpautop()

    Sorry I don’t have anything more productive to add. Not all plugins work together. Sometimes you need custom work to get the result.

    Plugin Author photocrati


    @kitchin – Thanks for sharing your thoughts and observations on this.

    – Cais.

    Dear photocrati, it’s not the problem of other plugins or wordpress’ engine. This behaviour was introduced in NextGen 2.0.71 and rollback to helps to resolve it, but it’s not a method. I wrote to you about it earlier this year, and you answered me that this feature is not supported in new NextGen 🙁

    Plugin Author photocrati


    @yegorka – If you wish to continue on with your issue please feel free to send us a Bug Report related to the latest release of NextGEN Gallery.


    – Cais.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘apply_filters doesn't work with shortcodes.’ is closed to new replies.