WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Having just grasped Custom Post Types I ventured into an article on how to Build a custom image slider using a Custom Post Type wherein I understand everything in the code (i.e. the creation of the CPT and the Meta Boxes). But there is a segment of code which I simply do not get...

add_filter("manage_feature_edit_columns", "feature_edit_columns");
    function feature_edit_columns($feature_columns){
        $feature_columns = array(
            "cb" => "<input type=\"checkbox\" />",
            "title" => "Title",
    return $feature_columns;

The Codex says that the first argument to add_filter is $tag (The name of the filter to hook the $function_to_add to), but the "tag" used in the above code is ...what? A Custom Tag?

please illuminate...


share|improve this question
up vote 1 down vote accepted

That particular bit of code actually appears to be incorrect, the format of the filter tag is slightly off.

But in general, some tags in WordPress are variable. Since WordPress gives you the ability to create your own post types and taxonomies, some filters and actions will contain a variable which refers to your custom type, so you can attach actions and filters that will only apply to those custom types.

As an example, refer to the codex page for manage edit-post type columns. The tag for this function is shown as:


Where ${post_type} is the name of your custom type. If your post type is named feature, this filter's tag will be:


If we look in WordPress source at the get_columns function in wp-admin/includes/class-wp-posts-list-table.php we can see where this filter is applied. First, the context of the function is determined:

$screen = get_current_screen();

if ( empty( $screen ) )
    $post_type = 'post';
    $post_type = $screen->post_type;

The $post_type variable is set to the type of post currently being edited. Then further down, the filter is applied, inserting this post type variable, allowing the user to add their own columns for their custom type to the edit screen:

$posts_columns = apply_filters( "manage_{$post_type}_posts_columns", $posts_columns );
share|improve this answer
Excellent answer. Actually cleared up a lot. Thanks! – sleeper Sep 3 '12 at 15:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.