WordPress custom content area with wp editor?

Using my WordPress theme functions file, I have created a custom meta text area (please see screenshot below).

The custom meta text area is displayed when editing a page.

Read More

enter image description here

It all works great saving and changing the text, but if i change a certain part of the paragraph text to heading2 and click save, it reverts the heading2 back to paragraph.

My functions update post meta box looks like the following:

if( isset( $_POST['my_meta_box_text_challengetbl'] ) )
    update_post_meta( $post_id, 'my_meta_box_text_challengetbl', wp_kses( $_POST['my_meta_box_text_challengetbl'], $allowed ) );
}

The $allowed php code looks like the following:

$allowed = array( 
    'a' => array( // on allow a tags
        'href' => array() // and those anchords can only have href attribute
    )
);

Related posts

1 comment

Comments are closed.