Site icon Hip-Hop Website Design and Development

WP_Editor Shortcode Situation

I’ve created a front-end editor utilizing wp_editor that capabilities because it ought to.

Upon testing I’ve observed that it’s stripping out any shortcodes which were inserted within the content material. I’ve appeared into this subject and located that it is the ‘ob_’ (output buffering) that’s eradicating them. If I take away this output buffering then the shortcodes show tremendous, however it breaks the performance I’ve created for the editor.

How would I hold the code I’m utilizing beneath, however amend it to be sure that all shortcodes are being displayed? Any assist/concepts enormously appreciated, S.

if(!is_feed() && current_user_can( 'manage_network' ) ) :

operate ps_add_post_editor($content material) {
world $submit;
$settings = array(
    'wpautop' => true,
    'media_buttons' => false
);
    $content material .= '<div id="content-edit-area" fashion="show:none;"><kind motion="" id="page-content-editor-panel" technique="submit"><span id="ajax_my_post_edit_nonce" class="hidden">' . wp_create_nonce( 'ajax_my_post_edit_nonce' ) . '</span>' . ps_get_wp_editor($post->post_content, 'textarea-' . $post->ID , $settings) . '<enter kind="submit" id="feesavebtn" worth="Save" /></kind><a href="#" id="cancelbtn">Cancel</a></div><br><br><div id="loadingmessage"><img src="'.get_template_directory_uri().'/photographs/loading.gif" /> saving...</div>

    <fashion kind="textual content/css">
        #textarea-'.$post->ID.'_ifr, #textarea-'.$post->ID.' { min-height:700px !necessary; }
    </fashion>

    <script kind="textual content/javascript">
    jQuery('#page-content-editor-panel').submit(operate(){       
    var pageid = '.$post->ID.'; 
    var content material;
    var editor = tinyMCE.get('textarea-'.$post->ID.'');
    if (editor) {
        content material = editor.getContent();
    } else {
        content material = jQuery('#textarea-'.$post->ID.'').val();
    }       
    jQuery('#content-edit-area').cover();  
    jQuery('#loadingmessage').present(); 
    jQuery.submit(
       ajaxurl, 
       {
          'motion':'add_foobar',
          'nonce':jQuery('#ajax_my_post_edit_nonce').textual content(),
          'post_id':pageid,
          'post_data':content material
       }, 
       operate(response){            
          window.location.reload(true); 
       }
    ); 
    return false;        
    });
    </script>';

return $content material;
}

operate ps_get_wp_editor($content material,$textarea,$settings) {
ob_start();
wp_editor($content material, $textarea, $settings);
$edior_html_code = ob_get_contents();
ob_end_clean();
return $edior_html_code;
} 
add_filter('the_content', 'ps_add_post_editor');

add_action('wp_ajax_add_foobar', 'prefix_ajax_add_foobar');
add_action('wp_ajax_nopriv_add_foobar', 'prefix_ajax_add_foobar');

operate prefix_ajax_add_foobar() {
if( wp_verify_nonce( $_REQUEST['nonce'], 'ajax_my_post_edit_nonce' ) )           {      
    $myfee_post = array();
    $myfee_post['ID'] = $_POST['post_id'];
    $myfee_post['post_content'] = $_POST['post_data'];
    wp_update_post( $myfee_post );      
    die("This web page has now been up to date."); 
} else {        
    die("Unable to course of your request right now.");
}
}

endif;