Seems that admin_post_{action} does not executing

It’s simply the wrong endpoint. The admin_post_* hook and its admin_post_nopriv_* counterpart is not fired for any admin page with the appropriate action request variable set, it only triggers for requests hitting wp-admin/admin-post.php. Try https://test.local/wp-admin/admin-post.php?action=test instead. I should add that using admin-post.php for handling plugin actions might not be appropriate. If you wanted to return … Read more

Cannot log in to the admin, no error message [closed]

Try to disable the plugins via the database running this query in your MySQL: UPDATE wp_options SET option_value=”a:0:{}” WHERE option_name=”active_plugins”; Also, try to enable error debugging in your wp-config.php file adding this line: define( ‘WP_DEBUG’, true ); Also, could you paste a copy of your .htaccess file?

How do I link to a php file in my plugin directory?

You can use admin.php?action=my_action and WordPress will fire the equivalent action hook: // How to get the URL $url = admin_url( “admin.php?action=wpse_21460_export&any_other_arguments” ); // How to handle the URL function wpse_21460_export() { // Do your export and exit } add_action( ‘admin_action_wpse_21460_export’, ‘wpse_21460_export’ ); See how WordPress formats the hook name to admin_action_{value_of_action_param}

How to get specific page screen ID

I don’t think it’s possible without accessing a global. This seems to work for all pages types, by using the global $_parent_pages with the function get_plugin_page_hookname: function nackle_get_screen_id( $slug ){ global $_parent_pages; $parent = array_key_exists( $slug, $_parent_pages ) ? $_parent_pages[$slug] : ”; return get_plugin_page_hookname( $slug, $parent ); } Usage example: echo nackle_get_screen_id( ‘my-custom-page-key’ ); Edit- … Read more

Restrict submitters from wp-admin [duplicate]

This is possible, drop this code into your theme’s functions.php file: add_action( ‘init’, ‘wpse_244614_no_dashboard_for_subscriber’ ); function wpse_244614_no_dashboard_for_subscriber() { $to = ‘https://google.com/’; $is_subscriber = current_user_can( ‘subscriber’ ); $in_backend = is_admin(); $doing_ajax = defined( ‘DOING_AJAX’ ) && DOING_AJAX; if ( $is_subscriber && $in_backend && ! $doing_ajax ) { wp_redirect( $to ); exit; } } Now whenever a … Read more