WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Custom Apply_filters Issue - Returns Null on Multiple (2 posts)

  1. cpres
    Member
    Posted 6 months ago #

    I'm building a way to extend a plugin I'm developing using the following filter for grabbing the html content from a different plugin:

    $content = apply_filters('satl_render_view', array($view, $slides));

    With just one plugin this works perfectly, but once I activate a second plugin utilizing this filter it stops working, $content is null :

    I'm adding the filters on the plugins in the __construct() method:
    add_filter('satl_render_view', array('SatellitePortraitPlugin','addRender'));
    and
    add_filter('satl_render_view', array('SatelliteAwesomePlugin', 'addRender'));

    Anyone run into this before?

    In case it helps, this is the addRender method as it currently stands:

    public static function addRender($params)
        {
            list($view, $slides) = $params;
            $plugin = new SatelliteAwesomePlugin();
            return $plugin->render($view, array('slides' => $slides, 'frompost' => 'false'), false);
        }

    For the record, I've tried remove_filter() if there is no content to return, but that didn't solve the problem.

  2. cpres
    Member
    Posted 5 months ago #

    I ended up figuring it out, I asked this same question on stackoverflow and left the answer there:

    http://stackoverflow.com/questions/21715981/wordpress-custom-filter-apply-filters-multiple

Reply

You must log in to post.

About this Topic