Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add $context to get_capability() #3866

Merged
merged 1 commit into from
Mar 20, 2024
Merged

Add $context to get_capability() #3866

merged 1 commit into from
Mar 20, 2024

Conversation

felipeelia
Copy link
Member

Description of the Change

Users wanting to manage synonyms-related capabilities, for example, can use the following snippet and add the manage_elasticpress_synonyms capability to their chosen role:

add_filter(
	'ep_capability',
	function ( $cacapability, $context ) {
		return ( 'synonyms' === $context ) ?
			'manage_elasticpress_synonyms' :
			$cacapability;
	},
	10,
	2
);

Closes #3787

How to test the Change

Changelog Entry

Added - Context parameter to the get_capability() function

Credits

Props @felipeelia @selim13

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@felipeelia felipeelia added this to the 5.1.0 milestone Mar 19, 2024
@felipeelia felipeelia merged commit b7d2afa into develop Mar 20, 2024
22 checks passed
@felipeelia felipeelia deleted the feature/issue-3787 branch March 20, 2024 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allowing non-admin users to edit synonyms and custom results
2 participants