Questions tagged [admin-init]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
13 views

Page is loading after submit before the file is processed

I have built a user import page that imports via csv file upload. The issue I am having is that the page is loading before all of the rows (user information) is finished processing/ inserting users. ...
0
votes
1answer
212 views

Admin_init not working in submenu page

I've a plugin divided into multiple pages and files based on classes. The base file (linked from plugin main file) contains code for menu and submenu pages and provides wordpress with their ...
0
votes
2answers
263 views

How to hook into the subscriber /wp-admin/index.php page?

I want to hook into the subscriber role index.php page (wp-admin/index.php) to add some custom content outside of the widgets. This admin_init works for all admin pages: add_action( 'init', '...
2
votes
1answer
462 views

Difference between hooks Plugin_loaded and admin_int?

As per my understanding, functions attached to plugin_loaded and admin_init hooks are called whenever any admin page is loaded. What's the difference between them?
0
votes
1answer
224 views

Why can't a custom postype be registered with “admin_init” hook?

Why do I need to use the "init" hook instead of the "admin_init" hook? init:fires after the core of the wordpress is loaded but before headers are sent admin init:before any other hook when the user ...
0
votes
1answer
2k views

Get current session in WP admin

Trying to access sessions in the WP admin and access a variable from it. function tasks_admin_sessions() { if(!session_id()) { session_start(); } } add_action( 'admin_init', '...
0
votes
0answers
345 views

Hide login page and use wp_login_form on ordinary pages

I would like to hide site.com/wp-login.php page but also to use wp_login_form() function where I want. Currently this function doesn't work if I hide login page with this code (it redirects to front ...
0
votes
2answers
461 views

Which hook for processing plugin page form data?

Which hook should I use for processing form data from my plugin pages. I currently use "admin_init". Is that correct? Was this hook intended to be used this way?
3
votes
2answers
133 views

Is it save to require plugin.php early to be able to use get_plugin_data() earlier?

I'd like to avoid hard coding my plugin's version at multiple places. To realize this the function get_plugin_data() comes in handy. But here the fun comes to an unpleasant stop. Checking for a plugin ...
0
votes
1answer
236 views

How to use hook admin_init for add_action for custom post type column

I'm adding a post thumbnail column to the edit custom post screen. The post thumbnails are showing up fine however I would like to hook it with admin_init to take some load off the website. This is ...
11
votes
2answers
13k views

Use wp init hook to call other hooks?

I want to know if it is a good practice according to WordPress theme or plugin development. add_action('init','all_my_hooks'); function all_my_hooks(){ // some initialization stuff here and then ...
0
votes
1answer
497 views

Editor capabilities - admin_init

I'm having a little difficulties with roles and capabilities. Editors gets a 'Cheatin uh?'-message when they try to update the custom theme-settings. Can anyone explain why - or maybe even have a ...
0
votes
1answer
555 views

wp_redirect and current_user_can issues

Put simply, I'm trying to redirect the user after clicking a 'Save Changes' button. The plugin uses custom capabilities, and so I want to check the current user has the correct capabilities before ...
53
votes
9answers
41k views

How do I Enqueue styles/scripts on Certain /wp-admin Pages?

I have two simple functions that load stuff using wp_enqueue_style() and wp_enqueue_script(), something like these: function admin_custom_css() { wp_enqueue_style( 'stylesheet_name', 'stylesheet.css')...