Вопрос к вам о WordPress.
Я хочу отобразить уведомление в верхней части post.php? Action = edit, если get_post_meta - это определенное значение ... какой-нибудь совет, как мне более эффективно это сделать? Кажется, я не получаю ответ от этого кода.
add_action('admin_notices', 'HMMultipostMU_notifyChild' );
if( !function_exists( 'HMMultipostMU_notifyChild' ) ){
function HMMultipostMU_notifyChild(){
global $hmMultipostMU;
if( !isset( $hmMultipostMU ) ){
return;
}
if($meta = get_post_meta($post_id, 'HMMultipostMU_parent', true)) {
$parent = unserialize( $meta );
if(!empty($parent)) {
foreach ($parent as $key => $value) {
switch_to_blog( $key );
echo '<div id="message" class="updated highlight"> WARNING: This is a child article! Please <a href='. get_edit_post_link( $value ). '>click here</a> to edit this article as the Parent. Be Aware, this may switch blog sites.<br /> </div>';
}
restore_current_blog();
}
}
}
}