R
R
Rimnox2014-02-20 21:19:38
WordPress
Rimnox, 2014-02-20 21:19:38

How to add meta fields in wordpress when saving a post?

I add code to functions.php

function sources_init($post_id) {
if(wp_is_post_revision($post_id)) return;
add_post_meta($post_id, '_sources', 'ТЕСТ');
}
add_action('save_post', 'sources_init');

Then I look into the database, and it's empty there. Where did you go wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rimnox, 2014-02-22
@Rimnox

the problem was in the meta-box plugin, conflicted

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question