最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

metabox - VisualText tabs in wp editor Not Showing

programmeradmin0浏览0评论

I have a wordpress website that i have added custom meta boxes to the post.

Custom meta boxes have an editor using wp_editor(), but the editor is refusing to show the visual/text tabs on the editor panel.

I have deactivating all plugins on my development, and the issue persisted.

Anyone can help me ?

I have a wordpress website that i have added custom meta boxes to the post.

Custom meta boxes have an editor using wp_editor(), but the editor is refusing to show the visual/text tabs on the editor panel.

I have deactivating all plugins on my development, and the issue persisted.

Anyone can help me ?

Share Improve this question asked Jan 16, 2016 at 11:54 Rizal IbnuRizal Ibnu 1195 bronze badges 2
  • Can you please edit your question and provide the code you are using to add wp_editor ? That will help the community to find where the problem is and you will get advise. – Prasad Nevase Commented Jan 16, 2016 at 15:24
  • One of the major reason is Yoast SEO plugin. Make sure that Yoast SEO plugin is up to date. – Mohamed Mamdouh Commented Feb 17, 2020 at 14:12
Add a comment  | 

2 Answers 2

Reset to default 1

Without seeing your code I can't say whats wrong but here is a working (tested) example of a metabox with an editor inside that has the visual/text tabs.

add_action( 'add_meta_boxes',  function() { 
    add_meta_box('html_myid_61_section', 'Meta Box Title', 'my_custom_meta_function');
});

function my_custom_meta_function( $post ) {
    $text= get_post_meta($post, 'my_custom_meta' , true );
    wp_editor( htmlspecialchars_decode($text), 'mettaabox_ID', $settings = array('textarea_name'=>'inputName') );
}

add_action( 'save_post', function($post_id) {
    if (!empty($_POST['inputName'])) {
        $data=htmlspecialchars($_POST['inputName']); 
        update_post_meta($post_id, 'my_custom_meta', $datta );
    }
}); 

Consider This...

I don't often recommend plugins BUT I would STRONGLY suggest using Advanced Custom Fields for stuff like this. Its easy to learn and will save you time and frustration! You can make professional admin layouts very fast.

You should assign a textarea_name and your editor ID should not contain other symbols other than dash ( - ) and underscores ( _ ).

wp_editor( 'Lorem Ipsum', 'editor-id', array('textarea_name'=>'message') );
发布评论

评论列表(0)

  1. 暂无评论