How to add custom attribute to Wordpress wp_editor text area?


Kapil yadav

How to add custom attribute to Wordpress wp_editor textarea field?

In the official documentation, there is no way to do this. I need to add a client-side validation attribute (data-bvalidator="required") to a text area generated by WordPress ' wp_editor method .

Any suggestions?

Ankur Bhadania

I don't think there is an option to add custom attributes in itwp_editor()

So you need to add a custom attribute in the field text-areausingJQuery

First add an extra class to the editortext-area

$settings =   array(
    ......
    'editor_class' => 'customclass_for_addattr',
    ......
);
wp_editor( $content, $editor_id, $settings  ); 

After the wp_editor() function, add the following jQuery code. It adds custom attributes to the method text-areausing jQueryatrr

<script type="text/javascript">
   jQuery(document).ready(function(){
      jQuery(".customclass_for_addattr").attr('data-bvalidator','required');
   });
</script>

Related


How to add custom attribute to Wordpress wp_editor text area?

Kapil yadav How to add custom attribute to Wordpress wp_editor textarea field? In the official documentation, there is no way to do this. I need to add a client-side validation attribute (data-bvalidator="required") to a text area generated by WordPress ' wp_e

How to add custom attribute to Wordpress wp_editor text area?

Kapil yadav How to add custom attribute to Wordpress wp_editor textarea field? In the official documentation, there is no way to do this. I need to add a client-side validation attribute (data-bvalidator="required") to a text area generated by WordPress ' wp_e

How to add custom attribute to Wordpress wp_editor text area?

Kapil yadav How to add custom attribute to Wordpress wp_editor textarea field? In the official documentation, there is no way to do this. I need to add a client-side validation attribute (data-bvalidator="required") to a text area generated by WordPress ' wp_e

How to add custom attribute to Wordpress wp_editor text area?

Kapil yadav How to add custom attribute to Wordpress wp_editor textarea field? In the official documentation, there is no way to do this. I need to add a client-side validation attribute (data-bvalidator="required") to a text area generated by WordPress ' wp_e

wordpress how to add wp_editor in array

Said Mohammad Aladdin I have a small problem with my wordpress code, I need to display a wordpress wp_editor in a page which has an array of values. These values are defined as follows $fields[] = array( 'name' => __('Class', 'my-theme'), '

wordpress how to add wp_editor in array

Said Mohammad Aladdin I have a small problem with my wordpress code, I need to display a wordpress wp_editor in a page which has an array of values. These values are defined as follows $fields[] = array( 'name' => __('Class', 'my-theme'), '

wordpress how to add wp_editor in array

Said Mohammad Aladdin I have a small problem with my wordpress code, I need to display a wordpress wp_editor in a page which has an array of values. These values are defined as follows $fields[] = array( 'name' => __('Class', 'my-theme'), '

wordpress how to add wp_editor in array

Said Mohammad Aladdin I have a small problem with my wordpress code, I need to display a wordpress wp_editor in a page which has an array of values. These values are defined as follows $fields[] = array( 'name' => __('Class', 'my-theme'), '

Replace text area wp_editor() with WordPress TinyMCE

Henry Wright I am trying to replace textarea with wp_editor() My textarea form element looks like this: <textarea name="post_text" id="post_text" rows="3"><?php echo $content; ?></textarea> Then I have: wp_editor( $content, 'post_text' ); The problem I'm hav

Replace text area wp_editor() with WordPress TinyMCE

Henry Wright I am trying to replace textarea with wp_editor() My textarea form element looks like this: <textarea name="post_text" id="post_text" rows="3"><?php echo $content; ?></textarea> Then I have: wp_editor( $content, 'post_text' ); The problem I'm hav

WordPress custom content area with wp editor?

Craig Using my Wordpress theme features file, I created a custom meta text area (see screenshot below). When editing a page, the custom element text area is displayed. Both saving and changing the text work fine, but if I change a specific part of the paragrap

WordPress custom content area with wp editor?

Craig Using my Wordpress theme features file, I created a custom meta text area (see screenshot below). When editing a page, the custom element text area is displayed. Both saving and changing the text work fine, but if I change a specific part of the paragrap

WordPress custom content area with wp editor?

Craig Using my Wordpress theme features file, I created a custom meta text area (see screenshot below). When editing a page, the custom element text area is displayed. Both saving and changing the text work fine, but if I change a specific part of the paragrap

WordPress custom content area with wp editor?

Craig Using my Wordpress theme features file, I created a custom meta text area (see screenshot below). When editing a page, the custom element text area is displayed. Both saving and changing the text work fine, but if I change a specific part of the paragrap

WordPress custom content area with wp editor?

Craig Using my Wordpress theme features file, I created a custom meta text area (see screenshot below). When editing a page, the custom element text area is displayed. Both saving and changing the text work fine, but if I change a specific part of the paragrap

WordPress custom content area with wp editor?

Craig Using my Wordpress theme features file, I created a custom meta text area (see screenshot below). When editing a page, the custom element text area is displayed. Both saving and changing the text work fine, but if I change a specific part of the paragrap

WordPress wp_editor removes html tags - how to stop it?

field Why does wp_editor remove all my html tags? Here is my code: /** * Outputs the content of the meta box. */ function prfx_meta_callback( $post ) { // echo 'This is a meta box'; wp_nonce_field( basename( __FILE__ ), 'prfx_nonce' ); $prfx_stor

WordPress wp_editor removes html tags - how to stop it?

field Why does wp_editor remove all my html tags? Here is my code: /** * Outputs the content of the meta box. */ function prfx_meta_callback( $post ) { // echo 'This is a meta box'; wp_nonce_field( basename( __FILE__ ), 'prfx_nonce' ); $prfx_stor

WordPress wp_editor removes html tags - how to stop it?

field Why does wp_editor remove all my html tags? Here is my code: /** * Outputs the content of the meta box. */ function prfx_meta_callback( $post ) { // echo 'This is a meta box'; wp_nonce_field( basename( __FILE__ ), 'prfx_nonce' ); $prfx_stor

WordPress wp_editor removes html tags - how to stop it?

field Why does wp_editor remove all my html tags? Here is my code: /** * Outputs the content of the meta box. */ function prfx_meta_callback( $post ) { // echo 'This is a meta box'; wp_nonce_field( basename( __FILE__ ), 'prfx_nonce' ); $prfx_stor

WordPress wp_editor removes html tags - how to stop it?

field Why does wp_editor remove all my html tags? Here is my code: /** * Outputs the content of the meta box. */ function prfx_meta_callback( $post ) { // echo 'This is a meta box'; wp_nonce_field( basename( __FILE__ ), 'prfx_nonce' ); $prfx_stor

WordPress wp_editor removes html tags - how to stop it?

field Why does wp_editor remove all my html tags? Here is my code: /** * Outputs the content of the meta box. */ function prfx_meta_callback( $post ) { // echo 'This is a meta box'; wp_nonce_field( basename( __FILE__ ), 'prfx_nonce' ); $prfx_stor

WordPress wp_editor removes html tags - how to stop it?

field Why does wp_editor remove all my html tags? Here is my code: /** * Outputs the content of the meta box. */ function prfx_meta_callback( $post ) { // echo 'This is a meta box'; wp_nonce_field( basename( __FILE__ ), 'prfx_nonce' ); $prfx_stor

WordPress wp_editor removes html tags - how to stop it?

field Why does wp_editor remove all my html tags? Here is my code: /** * Outputs the content of the meta box. */ function prfx_meta_callback( $post ) { // echo 'This is a meta box'; wp_nonce_field( basename( __FILE__ ), 'prfx_nonce' ); $prfx_stor

WordPress wp_editor removes html tags - how to stop it?

field Why does wp_editor remove all my html tags? Here is my code: /** * Outputs the content of the meta box. */ function prfx_meta_callback( $post ) { // echo 'This is a meta box'; wp_nonce_field( basename( __FILE__ ), 'prfx_nonce' ); $prfx_stor

WordPress wp_editor removes html tags - how to stop it?

field Why does wp_editor remove all my html tags? Here is my code: /** * Outputs the content of the meta box. */ function prfx_meta_callback( $post ) { // echo 'This is a meta box'; wp_nonce_field( basename( __FILE__ ), 'prfx_nonce' ); $prfx_stor

add js to wordpress with custom attribute

Surab I want to add the following code to the footer of my wordpress website. What is the best way to do this. <script async defer data-pin-hover="true" src="//assets.pinterest.com/js/pinit.js"></script> Teabing Go to theme, -> editor find footer.php and past