Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to add two custom field to table wp_posts, and that I need for my plugin. now to enable these fields I have changed core file of wordpress

$data = compact( array( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'post_mime_type', 'guid' ) );

here I have added two fields which I want.

Now I want these things as installable( I have manually added two fields here).

So how to do that within plugin.

I have read one post http://wp.tutsplus.com/tutorials/creative-coding/add-a-custom-column-in-posts-and-custom-post-types-admin-screen/ here hooks are used in theme function.php,but i want to do in plugin itself.

I am using wordpress 3.6.

still any confusion please comment I will update.

share|improve this question
put the code in a plugin. a hook is a hook, doesn't matter if it's in a theme or a plugin. I should point out here that modifying a core file should never be done, as well as modifying a core table. use post meta if you need to store additional data for a post. –  Milo Aug 19 '13 at 16:33
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer


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

Browse other questions tagged or ask your own question.