1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
<?php
/**
* BORROWED from AgentPress Listings
*
*This function redirects the user to an admin page, and adds query args
* to the URL string for alerts, etc.
*
* This is just a temporary function, until WordPress fixes add_query_arg(),
* or Genesis 1.8 is released, whichever comes first.
*
*/
function __admin_redirect( $page, $query_args = array() ) {
if ( ! $page )
return;
$url = html_entity_decode( menu_page_url( $page, 0 ) );
foreach ( (array) $query_args as $key => $value ) {
if ( isset( $key ) && isset( $value ) ) {
$url = add_query_arg( $key, $value, $url );
}
}
wp_redirect( esc_url_raw( $url ) );
}