Articles of wp admin

Change the Return URL from the Customizer

I want to change the return URL after someone cancels or closes out of their changes when using the Apperance -> Customize option within WordPress. In the wp-admin/customize.php file here is the code to control the return URL: wp_reset_vars( array( ‘url’, ‘return’ ) ); $url = wp_unslash( $url ); $url = wp_validate_redirect( $url, home_url( ‘/’ […]

WP Database Error (Windows Server 2008 & SQL Server)

I have a WP site up and running for my wife and she attempted to install a text widget that linked to her Twitter account (she says HTML was taken from I am not sure exactly what she did or what was going on, but now she gets the following error when going to […]

Just how 'expensive' is this function?

Having added a ‘word count’ admin column, I used this function from elsewhere on Stack to resave all posts and thus populate the word count (the wordcount function calculates on post-save). With just a couple hundred posts/pages on a dedicated server with almost no public traffic, I thought I’d be alright to ‘numberposts’ => -1′ […]

Filter Media Library by author or post_parent

I am trying to filter the Media Library so only media items that are uploaded by the current user OR children of the post being edited are visible. I’ve had no problem doing it if the conditions are both required, but I can’t figure out how to OR queries. I’ve found that you can define […]

Getting the different post statuses + count like in edit.php, in a custom submenu page

I’m trying to create a submenu page for reordering posts/pages. Right now I’m trying to include the list that display the different post statuses, for example: All (5) | Published (4) | Draft (1) I was digging around in edit.php and found that it pulls the list like this: $wp_list_table->views(); Which lead me to class-wp-list-table.php […]

Custom text-only header

I am developing a WordPress theme and would like to make use of a custom header on a the homepage (I’m using a custom page template). I would like this header to not include an image, but rather an <h1> and <h2> tag, and a link. So my question is the following – how do […]

Redirect users away from Admin breaks ajax

Tried to make a simple redirect for some users I don’t want to access the wp-admin/, so I did this code: function no_admin_access() { if ( !current_user_can( ‘delete_posts’ ) ) { wp_redirect( site_url( ‘/’ ) ); exit; } } add_action(‘admin_init’, ‘no_admin_access’); But when I then try to make a ajax request with those users, the […]

In the WordPress admin, how can I find out which page (themes.php, widgets.php, etc.) I'm on?

In the WordPress admin, how can I programmatically find out which page (themes.php, widgets.php, etc.) I’m on?

How to set Active plugins as the default screen?

In my testing environment, I’ve got one hundred plugins. I’m more interested in seeing first the Active plugins than the complete list (All). How can I change the default screen for the Plugins menu item?

remove_action with profile_personal_options

I’d like to remove the action profile_personal_options (more specifically the color scheme and visual editor checkbox) which shows up in wp-admin/user-edit.php. I believe it’s as simple as running it through remove_action(), but I’m not sure what the second parameter would be. Where would be the best place to look? remove_action(‘profile_personal_options’); I was previously using: function […]