Skip to content

Commit

Permalink
Pull in 10up#3004
Browse files Browse the repository at this point in the history
  • Loading branch information
rebeccahum committed Nov 9, 2022
1 parent b296b4a commit 4a75ee6
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions includes/classes/Feature/SearchOrdering/SearchOrdering.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ class SearchOrdering extends Feature {
*/
const TAXONOMY_NAME = 'ep_custom_result';

/**
* Capability required to manage.
*/
const CAPABILITY = 'manage_options';

/**
* Initialize feature setting it's config
*
Expand Down Expand Up @@ -210,7 +215,7 @@ public function admin_menu() {
'elasticpress',
esc_html__( 'Custom Results', 'elasticpress' ),
esc_html__( 'Custom Results', 'elasticpress' ),
'manage_options',
self::CAPABILITY,
'edit.php?post_type=' . self::POST_TYPE_NAME
);
}
Expand Down Expand Up @@ -685,7 +690,9 @@ public function rest_api_init() {
[
'methods' => 'GET',
'callback' => [ $this, 'handle_pointer_search' ],
'permission_callback' => '__return_true',
'permission_callback' => function() {
return current_user_can( self::CAPABILITY );
},
'args' => [
's' => [
'validate_callback' => function ( $param ) {
Expand All @@ -703,7 +710,9 @@ public function rest_api_init() {
[
'methods' => 'GET',
'callback' => [ $this, 'handle_pointer_preview' ],
'permission_callback' => '__return_true',
'permission_callback' => function() {
return current_user_can( self::CAPABILITY );
},
'args' => [
's' => [
'validate_callback' => function ( $param ) {
Expand Down

0 comments on commit 4a75ee6

Please sign in to comment.