Plupload in metabox – AJAX action not working in Class

Aha, the problem as that I was calling the wp_ajax_plupload_action from within my page conditional check like so:

function __construct()
{
    global $pagenow;

    $pages = array('post.php', 'post-new.php');

    if (in_array($pagenow, $pages)) :

        add_action('add_meta_boxes', array($this, 'dhf_video_meta_box'));
        add_action('admin_print_scripts', array($this, 'video_meta_js'));
        add_action('admin_head', array($this, 'plupload_admin_head'));
        add_action('admin_print_scripts', array($this, 'video_meta_css'));
        add_action('wp_ajax_plupload_action', array($this, 'plupload_action'));

    endif;
}

You don’t want to do it like that. Take the
add_action('wp_ajax_plupload_action', array($this, 'plupload_action')); outside of that check and everything works again.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)