SEOPress Metabox unter die ACF Felder bewegen

SEOPress unter die ACF Felder bewegen:

/* move SEOPress meta box down */
add_action( 'add_meta_boxes', function() {
global $wp_meta_boxes;

$post_type = 'page';

// Get seopress meta boxes
$seopress_meta_box = $wp_meta_boxes[$post_type]['normal']['high']['seopress_cpt'];
$seopress_analysis_meta_box = $wp_meta_boxes[$post_type]['normal']['high']['seopress_content_analysis'];

unset( $wp_meta_boxes[$post_type]['normal']['high']['seopress_cpt'] );
unset( $wp_meta_boxes[$post_type]['normal']['high']['seopress_content_analysis'] );

// Move it to 'advanced' location with 'low' priority.
if ( empty( $wp_meta_boxes[$post_type]['advanced'] ) ) {
$wp_meta_boxes[$post_type]['advanced'] = [];
}
if ( empty( $wp_meta_boxes[$post_type]['advanced']['low'] ) ) {
$wp_meta_boxes[$post_type]['advanced']['low'] = [];
}
$wp_meta_boxes[$post_type]['advanced']['low']['seopress_cpt'] = $seopress_meta_box;
$wp_meta_boxes[$post_type]['advanced']['low']['seopress_content_analysis'] = $seopress_analysis_meta_box;

}, 99 );

Wenn die SEOPress Metabox gleich bei mehreren Content Typen (z.B. auch bei Custom Post Types)  unterhalb der ACF-Felder bewegen will muss der Code lediglich in einen entsprechenden foreach-Loop gekapselt werden – die Variable ‚post_type‘ wird durch den Array ‚post_types‘ ersetzt:

/* move SEOPress meta box down */
add_action( 'add_meta_boxes', function() {
global $wp_meta_boxes;

$post_types = array('post','page','custon_post_type');

foreach($post_types as $post_type) {

// Get seopress meta boxes
$seopress_meta_box = $wp_meta_boxes[$post_type]['normal']['high']['seopress_cpt'];
$seopress_analysis_meta_box = $wp_meta_boxes[$post_type]['normal']['high']['seopress_content_analysis'];

unset( $wp_meta_boxes[$post_type]['normal']['high']['seopress_cpt'] );
unset( $wp_meta_boxes[$post_type]['normal']['high']['seopress_content_analysis'] );

// Move it to 'advanced' location with 'low' priority.
if ( empty( $wp_meta_boxes[$post_type]['advanced'] ) ) {
$wp_meta_boxes[$post_type]['advanced'] = [];
}
if ( empty( $wp_meta_boxes[$post_type]['advanced']['low'] ) ) {
$wp_meta_boxes[$post_type]['advanced']['low'] = [];
}
$wp_meta_boxes[$post_type]['advanced']['low']['seopress_cpt'] = $seopress_meta_box;
$wp_meta_boxes[$post_type]['advanced']['low']['seopress_content_analysis'] = $seopress_analysis_meta_box;

}
}, 99 );

 

In Anlehnung an „WordPress: Change meta box location“
https://deluxeblogtips.com/wordpress-change-meta-box-location/

Siehe auch „Moving meta boxes in admin“
https://wordpress.stackexchange.com/questions/166825/moving-meta-boxes-in-admin

Und auch hier: „How to reorder meta box position?“
https://wordpress.stackexchange.com/questions/57897/how-to-reorder-meta-box-position

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert