Asynchronous multiple requests 401 Unauthorized

Apparently, this already is a known issue on GitHub. Still open and not patched from May 16, 2016. Based on the suggestion from the comments, creating a new Hooks instance and registering the hook curl.before_multi_add with a callback that sets the cURL authentication options should solve the [401] Unauthorized Access problem. use WpOrg\Requests\Hooks; $hooks = … Read more

Redeclaring a plugin function within a class

How does wordpress know that the add_meta_box() function used inside the user-defined add_meta_box( $post_type ) function is a plugin function and not a recursive one? It doesn’t, WordPress just calls it, so you can indeed create infinite loops. Instead what I think you’re asking is how PHP knows to call that class method and not … Read more

Can’t get AJAX call working in custom plugin

So the AJAX action defined in Myplugin::define_admin_hooks() has been corrected (it’s just a typo in the question). But there’s another issue in your code, also in the above function, where the second parameter for $this->loader->add_action() should actually be $plugin_admin (which is an object and an instance of the Myplugin_Admin class) and not wp_ajax: Incorrect: $this->loader->add_action( … Read more

Check if variable is set in filter

The variable you have named $query is actually the WP_Query instance having filters applied to it. You can simply call its function get to retrieve query vars. For example: function votes( $where, $query ) { $sort = $query->get(‘sort’); if (!empty($sort) $where .= ” AND $sort >= votes”; return $where; }