0

I know that manage_posts_columns is the hook for managing the column in post screen.

I can add a column with following code,

// add new column hook
add_filter('manage_posts_columns', 'add_new_column_in_posts');
function add_new_column_in_posts($columns) {
    $columns['premium'] = 'Premium';
    return $columns;
}

My question is, how can I feed the simple_field value for that column?

1

Ref. https://codex.wordpress.org/Plugin_API/Action_Reference/manage_posts_custom_column Just use the WP built in action called "manage_posts_custom_column" and in callback check for the correct column and add simple_field value with the function simple_fields_value :

            add_action( 'manage_posts_custom_column' , 'add_new_column_data_in_posts', 10, 2 );

            function add_new_column_data_in_posts( $column, $post_id ) {
                switch ( $column ) {
                    case 'premium' :
                        echo simple_fields_value("simple_field_slug", $post_id); 
                        break;
                    }
            }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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