Can you add the visual editor to the description field for custom taxonomies?
-
16-10-2019 - |
Pergunta
Can you add the visual editor to the description field for custom taxonomies? It would be nice to have this option available when you edit an entry for a taxonomy be it core or custom.
Solução
Just wrote the function. It'll display the tinymce editor in every custom taxonomy description right now. Surely you can edit to show it for only some specific taxonomy.
/**
* Display advanced TinyMCE editor in taxonomy page
*/
function wpse_7156_enqueue_category() {
global $pagenow, $current_screen;
if( $pagenow == 'edit-tags.php' ) {
require_once(ABSPATH . 'wp-admin/includes/post.php');
require_once(ABSPATH . 'wp-admin/includes/template.php');
wp_tiny_mce( false, array( 'editor_selector' => 'description', 'elements' => 'description', 'mode' => 'exact' ));
}
}
add_action( 'init', 'wpse_7156_enqueue_category' );
You can provide the first argument in wp_tiny_mce
as true
if you want a stripped version of tinyMCE
Outras dicas
Have you tried The Rich Text Tags Plugin?
- It does exactly what you need.
- Works with custom taxonomies.
- Works well with images.
- Includes the new WP internal linking.
- It is regularly updated.
Screenshot:
Not directly, no.
You could, however, write a custom javascript which applies the appropriate classes to the entry field for the custom taxonomy description.
If what you really want to do, however, is create a "many-to-many" relationship between posts (e.g. a post type of "Tires" and a post type of "Cars"), then WordPress doesn't (currently) have a facility for this. However, the Posts 2 Posts plugin does provide this functionality (and gives you a lot more flexibility to create complex relationships).