Use filter for getTerms search
[MAILPOET-1293]
This commit is contained in:
@ -4,6 +4,7 @@ namespace MailPoet\API\JSON\v1;
|
||||
|
||||
use MailPoet\API\JSON\Endpoint as APIEndpoint;
|
||||
use MailPoet\Config\AccessControl;
|
||||
use MailPoet\WP\Hooks;
|
||||
use MailPoet\WP\Posts as WPPosts;
|
||||
|
||||
if(!defined('ABSPATH')) exit;
|
||||
@ -43,20 +44,19 @@ class AutomatedLatestContent extends APIEndpoint {
|
||||
$search = (isset($data['search'])) ? $data['search'] : '';
|
||||
$limit = (isset($data['limit'])) ? (int)$data['limit'] : 50;
|
||||
$page = (isset($data['page'])) ? (int)$data['page'] : 1;
|
||||
|
||||
return $this->successResponse(
|
||||
WPPosts::getTerms(
|
||||
array(
|
||||
'taxonomy' => $taxonomies,
|
||||
'hide_empty' => false,
|
||||
'search' => $search,
|
||||
'number' => $limit,
|
||||
'offset' => $limit * ($page - 1),
|
||||
'orderby' => 'name',
|
||||
'order' => 'ASC'
|
||||
)
|
||||
)
|
||||
$args = array(
|
||||
'taxonomy' => $taxonomies,
|
||||
'hide_empty' => false,
|
||||
'search' => $search,
|
||||
'number' => $limit,
|
||||
'offset' => $limit * ($page - 1),
|
||||
'orderby' => 'name',
|
||||
'order' => 'ASC'
|
||||
);
|
||||
|
||||
$args = Hooks::applyFilters('mailpoet_search_terms_args', $args);
|
||||
|
||||
return $this->successResponse(WPPosts::getTerms($args));
|
||||
}
|
||||
|
||||
function getPosts($data = array()) {
|
||||
|
Reference in New Issue
Block a user