WordPress.org

Ready to get started?Download WordPress

Forums

Are there widget (or sidebar) output hooks? (6 posts)

  1. jeffb0
    Member
    Posted 4 years ago #

    I'm trying to filter ALL widget output through a simple filter, but can't find any hooks and was hoping to be pointed in the right direction. Or possibly my efforts are not even possible?

    My simple filter is something like this:

    function clean_widget_output( $input ) {
        return str_replace( array( "\t", "\n", "\r" ), '', $input );
    }
    
    add_[FILTER OR ACTION]( 'need_a_hook', 'clean_widget_output', 99 );

    Any pointers? I'm pretty new to PHP, but I can get around.

  2. jeffb0
    Member
    Posted 4 years ago #

    Bump.

  3. jeffb0
    Member
    Posted 4 years ago #

    Well it appears the answer is elusive. Not even the helpful stackoverflow community knows (see http://stackoverflow.com/questions/1385954/do-wordpress-widget-or-sidebar-hooks-exist ).

    This question is ranking #1 in google, so I'll post my results as soon as I can trying an output buffering method.

  4. jeffb0
    Member
    Posted 4 years ago #

    So I figured out how to modify all widget output. Check the link above if you're interested.

  5. alanft
    Member
    Posted 4 years ago #

    i built a 'widget_content' filter into my plugin

    http://wordpress.org/extend/plugins/widget-logic/

  6. jeffb0
    Member
    Posted 4 years ago #

    I checked it out already, it's an excellent plugin. Looks like we took a similar approach to accomplish the filtering.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags