0

I want to move the Featured image panel in admin from side to under content position. I've found how to do it with php but it isn't working when Gutenberg is being used.

Removing panels (meta boxes) in the Block Editor Here is an explanation of how to remove a block in Block Editor, but it isn't what I need.

1 Answer 1

0

So it's duct tape solution but it does what I need. Posting here my solution for the future me or the new generation. Need to add a delay and wait until the feature image where be added to the page.

if ( is_admin() ) {
  function admin_editor_scripts() {
    $script = "
    jQuery( window ).on('load', function() {
      let timerMoveFeatureImage = setInterval(function(){
        let featureBlock = document.getElementsByClassName('editor-post-featured-image');
        if (featureBlock.length > 0) {
          clearInterval(timerMoveFeatureImage);
          document.getElementById('normal-sortables').prepend(document.getElementsByClassName('editor-post-featured-image')[0].parentElement);
        }
      }, 1000);
    });";
    wp_add_inline_script( 'wp-blocks', $script );
  }
  add_action( 'enqueue_block_editor_assets', 'admin_editor_scripts' );
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.