php - Wordpress last revision date -
i try add column date of last revision , use code. there wrong here? thing is, doesn't work, doesn't give me error message
add_filter('manage_pages_columns', 'add_revised_column'); add_action('manage_pages_custom_column', 'echo_revised_column', 10, 2); function add_revised_column($columns) { $columns['revised'] = 'revised'; return $columns; } function echo_revised_column($column, $id) { if ('revised' == $column) echo get_post_field('post_modified', $id); }
this looks fine me in general. similar add media height x width dimensions on manage media page, , code pattern identical.
but: recommend create constant, , use throughout avoid issue, eg:
define('col_name_revised','revised'); ... $columns['col_name_revised'] = 'revision info'; ... if (col_name_revised == $column) ...
edit: had answered key-names mismatched, on re-visiting question realised not mismatched. therefore, afaik op's code ok.
Comments
Post a Comment