Answer the question
In order to leave comments, you need to log in
Data is not being added to the new field?
There are 2 types of records clients and projects, it was necessary to link these types of records
than the issue was resolved through metabox and post_parent everything works fine, but there is 1 more record type that needs to be associated with the rest, as we know the post_parent field is index and cannot be multiple, so I decided create a new field in the database let's say post_svyazka
added 1 more metabox but the data is not written, what could be wrong?
metabox code
add_action('add_meta_boxes', function () {
add_meta_box( 'otrasli', 'Отрасль продукции', 'otr_team_metabox', 'products', 'side', 'low' );
}, 1);
// метабокс с селектом команд
function otr_team_metabox( $post ){
$teams = get_posts(array( 'post_type'=>'otrasli', 'posts_per_page'=>-1, 'orderby'=>'post_title', 'order'=>'ASC' ));
if( $teams ){
// чтобы портянка пряталась под скролл...
echo '
<div style="max-height:200px; overflow-y:auto;">
<ul>
';
foreach( $teams as $team ){
echo '
<li><label>
<input type="radio" name="post_svyazka" value="'. $team->ID .'" '. checked($team->ID, $post->post_svyazka, 0) .'> '. esc_html($team->post_title) .'
</label></li>
';
}
echo '
</ul>
</div>';
}
else
echo 'ничего нет...';
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question