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

Hey all i have this code here:

if ( !function_exists('AddThumbColumn') && function_exists('add_theme_support') ) {
    // for post and page
    add_theme_support('post-thumbnails', array( 'post', 'page' ) );

    function AddThumbColumn($cols) {
        $cols['thumbnail'] = __('Header Images');
        return $cols;

    function AddThumbValue($column_name, $post_id) {
        echo 'Header Image data here';

    add_filter( 'manage_pages_columns', 'AddThumbColumn' );
    add_action( 'manage_pages_custom_column', 'AddThumbValue', 10, 2 );

    function AddThumbColumn2($cols) {
        $cols['cssColor'] = __('CSS Color');
        return $cols;

    function AddThumbValue2($column_name, $post_id) {
        //code goes here for second column      

    add_filter( 'manage_pages_columns', 'AddThumbColumn2' );
    add_action( 'manage_pages_custom_column', 'AddThumbValue2', 10, 2 );

And that works with creating 2 separate columns (Header Images, CSS Color) but it seems to duplicate the data in Header Images in the CSS color..?

What am i missing in order to have each column separate with data for its own?

share|improve this question
up vote 1 down vote accepted

functions attached to manage_pages_custom_column get fired for every custom column, you have to check the name of the column within the function to only output data for that specific column:

add_action( 'manage_pages_custom_column', 'AddColumnValue', 10, 2 );

function AddColumnValue( $column_name, $post_id ) {
    if( 'thumbnail' == $column_name ):
        echo 'Header Image data here';
    elseif( 'cssColor' == $column_name ):
        //code goes here for second column
share|improve this answer
Thank you! That works just fine. – StealthRT Sep 29 '12 at 22:10

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.