-
Notifications
You must be signed in to change notification settings - Fork 897
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
API function/method: Get all WPSEO related capabilities #9300
Comments
I can make a PR for this if you want. I just need to know where you would like to put this.
|
That would be awesome! We can always change the actual logic that fetches the capabilities and provide this easy API for other plugins, like yours, to use. |
Please give us a description of what happened.
Please see these two PR's:
#7937 (compatibility with role managers)
#9285 (bugfix getting capabilities on frontend)
Please describe what you expected to happen and why.
There is no simple way (API) to fetch all the capabilities used by Yoast SEO.
For example, GravityForms has a simple method to fetch all capabilities used in the plugin:
GFCommon::all_caps()
My current solution is this:
This is off course not very neat and could cause bugs when the WPSEO codebase changes. See #9285 for example.
I think it would be best to create a centralized method for this purpose.
WPSEO_Utils::get_capabilities()
or something. Or maybe just a function:wpseo_get_capabilities()
..backstory
I'm the author of View Admin As, a plugin which let you switch users, roles, capabilities, languages etc.etc. straight from the wp toolbar. Especially the capability switcher relies on compatibility with other plugins so I'm trying to check for other plugins and their capabilities as much as I can.
This works fine for Yoast SEO capabilities on the backend since my PR #7937 but this doesn't work on the frontend. Since the adminbar is also loaded on the frontend when logged in I'm also loading thirdparty capabilities there.
Example for the Yoast SEO caps: https://github.com/JoryHogeveen/view-admin-as/blob/8b94155b042aa4feaaae8b5c84eb3e807fdb867d/includes/class-compat.php#L331-L352
Technical info
The text was updated successfully, but these errors were encountered: