Hot answers tagged

4

As you've already discovered, links to the customizer always start with /wp-admin/customize.php. Append ?autofocus[section] =section_name to checkout your section within the customizer. Both parameters (section and section_name) are registered within your customize_register hook: $wp_customize->add_section If you can't find the hook, check the HTML ...


2

Wordpress do not have a true concept of "logged in". Although the labels all around use the term, in the code the closest you get is something that might be called "authenticated users". The difference is that the authenticated user might be one that has his browser closed and therefor he is not "logged in". To do what you want you will first need to define ...


2

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 ...


1

You can add a link to the widgets.php like that: add_action( 'admin_menu', 'f711_add_widgets_shortcut', 999 ); function f711_add_widgets_shortcut() { add_menu_page( 'Widgets', 'Widgets', 'publish_pages', 'widgets.php', '', '', 61 ); } Be sure to check your permission settings, and you may also include another image. You can find the documentation ...


1

The other answer is not working for my site. I tried this script instead and it works fine for removing the WordPress version number from the right footer of admin pages: add_filter( 'admin_footer_text', '__return_empty_string', 11 ); add_filter( 'update_footer', '__return_empty_string', 11 );


1

In general, it is a bad idea to upgrade from such an old version to new version in one go. In your case, a huge amount of changes was done between the release of v3.8.1 and v4.4.1 which invloved changes in the db. I'm not sure which is the best option here to repair the db as it seems that you cannot log into the site. What I would suggest is, revert back ...


1

You can actually use the function you're using, you just need to use load-index.php (no need for globals if you don't need them): add_action('load-index.php', function(){ if(get_current_screen()->base == 'dashboard' && !wp_is_mobile()) wp_redirect(admin_url('edit.php')); });


1

If you want this for all future users then hook into the user_register event and update it there. Pull the WP_User using get_userdata and wp_update_user info with the new display name. add_action( 'user_register', 'wpse_20160110_user_register', 10, 1 ); function wpse_20160110_user_register ( $user_id ) { // get the user data $user_info = ...


1

It's what I thought - you're trying to send the file from the display callback, by which time it's too late. Look for the add_*_page() call that registers the menu item in the admin sidebar - the return value of this function call is the name of the hook you can use to attach the download function: $hook = add_submenu_page( $parent, $title, $menu_title, ...


1

I believe you will need to add it via add_menu_page - but in the callback function you register that displays the page, you could re-direct away from it (or just display your own message), as needed. You could also remove it from showing up on the admin menu by calling remove_menu_page right after you add it. That ought to leave the page registered (with ...



Only top voted, non community-wiki answers of a minimum length are eligible