[wp-hackers] New Filter Request: get_tags_to_edit

Charles Iliya Krempeaux supercanadian at gmail.com
Fri Feb 15 22:14:22 GMT 2008


Hello,

I'd like to request a new filter.  I want the filter so I can write a
WordPress plugin that will set a default list tags to be
pre-populated, on the write post page, when the user is writing a new
post.


>From what I can tell, the function that sets these tags is...

function get_tags_to_edit( $post_id ) {
        global $wpdb;

        $post_id = (int) $post_id;
        if ( !$post_id )
                return false;

        $tags = wp_get_post_tags($post_id);

        if ( !$tags )
                return false;

        foreach ( $tags as $tag )
                $tag_names[] = $tag->name;
        $tags_to_edit = join( ', ', $tag_names );
        $tags_to_edit = attribute_escape( $tags_to_edit );
        $tags_to_edit = apply_filters( 'tags_to_edit', $tags_to_edit );
        return $tags_to_edit;
}

(This can be found in "wp-admin/includes/taxonomy.php".)

I'd like the hook to be something like...


function get_tags_to_edit( $post_id ) {
        global $wpdb;

        $post_id = (int) $post_id;
        if ( !$post_id )
                return false;

        $tags = wp_get_post_tags($post_id);

        // NEW HOOK HERE
        apply_filters('get_tags_to_edit', $tags);

        if ( !$tags )
                return false;

        foreach ( $tags as $tag )
                $tag_names[] = $tag->name;
        $tags_to_edit = join( ', ', $tag_names );
        $tags_to_edit = attribute_escape( $tags_to_edit );
        $tags_to_edit = apply_filters( 'tags_to_edit', $tags_to_edit );
        return $tags_to_edit;
}


Or something similar.

Thanks.

See ya

-- 
Charles Iliya Krempeaux, B.Sc.
http://ChangeLog.ca/

Motorsport Videos
http://TireBiterZ.com/

Vlog Razor... Vlogging News... http://vlograzor.com/


More information about the wp-hackers mailing list