How do I set up a webhook?

You are using self-hosted WordPress, which sometimes referred to as WordPress.org. Calling remote hook is still a possibility there, but unless your e-commerce solution supports it, you may need to add a custom code. Option – find a plugin There are some plugins which will post data to external URL when certain event happens, say, … Read more

Custom WP_List_Table displays blank rows

You’re getting the blank rows because your column headers are registered late. And you should register the headers (i.e. initialize the list table class instance) before admin notices are rendered on the page, i.e. before WordPress fires hooks like admin_notices. But your customer_list_page() function, which I believe, is a callback for either add_menu_page() or add_submenu_page(), … Read more

Remove admin AND editor from the “change role to” menu in user listing

Try using below code to remove administrator and editor option from drop down. Use editable_roles filter function wdm_user_role_dropdown($all_roles) { global $pagenow; if( current_user_can(‘editor’) && $pagenow == ‘user-edit.php’ ) { // if current user is editor AND current page is edit user page unset($all_roles[‘administrator’]); unset($all_roles[‘editor’]); } return $all_roles; } add_filter(‘editable_roles’,’wdm_user_role_dropdown’);

Remove ability to access certain admin menus

I figured it out in the end and this is the code I used: function restrict_menus() { $author = wp_get_current_user(); if( isset( $author->roles[0] ) ) { $current_role = $author->roles[0]; } else { $current_role=”no_role”; } if( ‘contributor’ == $current_role ) { $screen = get_current_screen(); $base = $screen->id; if( ‘edit-post’ == $base || ‘upload’ == $base || … Read more

Turn off admin emails for new user registrations

Function wp_new_user_notification is pluggable. It means that you can override it by declaring your version of this function in your plugin/theme. So, if you wish to disable all notifications completely, do it like this: if ( !function_exists( ‘wp_new_user_notification’ ) ) : function wp_new_user_notification( $user_id, $plaintext_pass=”” ) { return; } endif; However I wouldn’t recommend you … Read more

Using require_once() within admin

Avoid native php functions They are not relative, so breaking stuff is easy. (like in the OPs case) Why role your own if core got a function for you? They don’t consider edge cases You should NEVER use the constants STYLESHEET_DIRECTORY TEMPLATE_DIRECTORY WP_PLUGIN_DIR etc… Remember: Those are not API! and can therefore change! but INSTEAD … Read more