10

Can anybody tell me that how can I enable the option of table in wordpress editor?

I used below code which help me to enable other option, but not for the table.

My function.php

  <?php

      function add_more_buttons($buttons) {
       $buttons[] = 'hr';
       $buttons[] = 'del';
       $buttons[] = 'sub';
       $buttons[] = 'sup';
       $buttons[] = 'fontselect';
       $buttons[] = 'fontsizeselect';
       $buttons[] = 'cleanup';
       $buttons[] = 'tablecontrols';
       return $buttons;
 }
 add_filter("mce_buttons_3", "add_more_buttons");

 ?>
2
  • WordPress doesn't ship with the table plugin for TinyMCE, you need to manually add the appropriate HTML, JS and CSS files or you can just use this plugin.
    – Chris Haas
    Jul 18, 2014 at 14:47
  • Do you get solution for your question ??
    – Ajesh VC
    Aug 10, 2014 at 3:51

3 Answers 3

19

Without a Plugin

You need to download the "table" folder from the TinyMCE editor package. The easiest way download it is to use the TinyMCE version 4 Custom Build tool. (WordPress doesn't use the latest version of TinyMCE, so you need the plugin built for version 4.) Uncheck everything except the "table" plugin.

Once you've downloaded it, unzip it and navigate to /tinymce/plugins and copy the "table" folder.

In this example, I'm copying it to a new folder called "tinymce-plugins" that I've created in my WordPress site's "wp-content" folder.

Windows Explorer window showing the contents of "wp-content" with the sub-folder "tinymce-plugins" highlighted

In your theme's function.php file, register the button and include the path to the JavaScript file:

function add_the_table_button( $buttons ) {
    array_push( $buttons, 'separator', 'table' );
    return $buttons;
}
add_filter( 'mce_buttons', 'add_the_table_button' );

function add_the_table_plugin( $plugins ) {
      $plugins['table'] = content_url() . '/tinymce-plugins/table/plugin.min.js';
      return $plugins;
}
add_filter( 'mce_external_plugins', 'add_the_table_plugin' );

Then BOOM! The table functionality is activated.

A screenshot of the TinyMCE editor toolbar with the table icon expanded, showing table inclusion and formatting options

6
  • The TinyMCE website has completely changed... is there a way to go get that plugin now?
    – Fredy31
    Apr 2, 2019 at 19:15
  • @Fredy31 the way is still the same. Download TinyMCE as a self-hosted release from download page. You may also use their build customizer - uncheck all options and check only "table" addon.
    – fandasson
    Apr 15, 2019 at 12:27
  • When using this approach, I get the following Error in WP 5.6.3: tinymce.min.js?ver=49110-20201110:2 Failed to initialize plugin: table TypeError: Cannot read property 'registry' of undefined
    – rassoh
    Apr 19, 2021 at 9:13
  • 1
    @rassoh Wordpress is using Tİnymce version 4.9.11. So you need to change the Tinymce version that you downloaded. Do not use Tİnymce v5. Jul 7, 2021 at 9:32
  • 1
    Yeah that still works - just replace the version in the current link - the link for the moment is.
    – Picard
    Sep 30, 2022 at 9:36
0

To enable table option in wordpress page editor you can use plugin like

1.TablePress

2.TinyMCE

install and activate plugin ,see documentation to how this works.

In TablePress you can create tables from dashboard and can include this in page or post from editor menu(insert table from TablePress) or can use shortcode too.
download link : http://wordpress.org/extend/plugins/tablepress/

2TinyMCE

To display the full TinyMCE text editor so you have access to all of the advanced features available, add the following code to your functions.php file to enable hidden buttons:(below code is compatible with some of the new wordpress version only so try to use plugins itself).

function enable_more_buttons($buttons) {

$buttons[] = 'fontselect';
$buttons[] = 'fontsizeselect';
$buttons[] = 'styleselect';
$buttons[] = 'backcolor';
$buttons[] = 'newdocument';
$buttons[] = 'cut';
$buttons[] = 'copy';
$buttons[] = 'charmap';
$buttons[] = 'hr';
$buttons[] = 'visualaid';

return $buttons;

}
add_filter("mce_buttons_3", "enable_more_buttons”);

To keep the kitchen sink always on, also add this snippet to your functions.php file:

add_filter( 'tiny_mce_before_init', 'myformatTinyMCE' );
function myformatTinyMCE( $in ) {

$in['wordpress_adv_hidden'] = FALSE;

return $in;
}

download link ::TinyMCE Advanced :: https://wordpress.org/plugins/tinymce-advanced/

2
  • Is that not possible without plugin? Jul 18, 2014 at 18:31
  • why not but i think you need to write html, css and js for this.I just answer the easy method. it must help you to add tables in your pages or post through editor
    – Ajesh VC
    Jul 19, 2014 at 3:25
-3

You don't need to enable table option in the Wordpress editor to use tables inside it.

You can just build your table with the <table>, <tr>, <td> tags and paste the finale result inside the editor.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

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

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