Closed vtad closed 5 years ago
Issue-Label Bot is automatically applying the label Type: Bug
to this issue, with a confidence of 0.69. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!
Links: app homepage, dashboard and code for this bot.
Pods has helper functions for it's classes. In your case this should work (and be a better solution):
remove_action( 'media_buttons', array( pods_admin(), 'media_button' ), 12 );
Also, since this is related to admin I'd always wrap it inside with if ( is_admin() )
.
I reactivated the action, and now it works fine - seemed to be a caching problem just after the update.
I think this issue should be set as a warning, cause WP 5.22 deactivates the plugin when it gets the a fatal error after the update.
@JoryHogeveen pods_admin() works also, since it is for all (edit) users I didn't wrap it with if(is_admin())
@vtad Glad to year the issue is resolved.
One comment:
is_admin()
has nothing to do with users. It checks whether the current page is within the admin interface or not (wp_admin
).
In your case you want to remove the media buttons from Pods, which are only visible within the WordPress admin. That's why I recommended to wrap it in is_admin()
.
Documentation: https://codex.wordpress.org/Function_Reference/is_admin
Validation users can be done with current_user_can( $capability )
or is_super_admin()
.
Describe the bug
I used until 2.7.13 in functions.php
remove_action( 'media_buttons', array( PodsInit::$admin, 'media_button' ), 12 );
which now throws a Typ E_ERROR since the class is not foundPods Version
2.7.14
WordPress Environment
Possible Workaround I deleted the action from functions.php