Skip to main content
Missing closing parentheses in function.
Source Link
s_ha_dum
  • 65.5k
  • 13
  • 84
  • 174

I'd say template_redirect. But take a look at the Action Reference.

Example

Don't forget to exit() on redirect.

/**
 * This example redirects everything to the index.php page
 * You can do the same for the dashboard with admin_url( '/' );
 * Or simply base the redirect on conditionals like 
 * is_*() functions, current_user_can( 'capability' ), globals, get_current_screen()...
 * 
 * @return void
 */
function your_unique_redirect_function wpse12535_redirect_sample() {

    exit( wp_redirect( home_url( '/' ) ) );

}

add_action( 'template_redirect', 'your_unique_redirect_function''wpse12535_redirect_sample' );

I'd say template_redirect. But take a look at the Action Reference.

Example

Don't forget to exit() on redirect.

/**
 * This example redirects everything to the index.php page
 * You can do the same for the dashboard with admin_url( '/' );
 * Or simply base the redirect on conditionals like 
 * is_*() functions, current_user_can( 'capability' ), globals, get_current_screen()...
 * 
 * @return void
 */
function your_unique_redirect_function () {

    exit( wp_redirect( home_url( '/' ) ) );

}

add_action( 'template_redirect', 'your_unique_redirect_function' );

I'd say template_redirect. But take a look at the Action Reference.

Example

Don't forget to exit() on redirect.

/**
 * This example redirects everything to the index.php page
 * You can do the same for the dashboard with admin_url( '/' );
 * Or simply base the redirect on conditionals like 
 * is_*() functions, current_user_can( 'capability' ), globals, get_current_screen()...
 * 
 * @return void
 */
function wpse12535_redirect_sample() {

    exit( wp_redirect( home_url( '/' ) ) );

}

add_action( 'template_redirect', 'wpse12535_redirect_sample' );

I'd say template_redirect. But take a look at the Action Reference.

Example

Don't forget to exit() on redirect.

/**
 * This example redirects everything to the index.php page
 * You can do the same for the dashboard with admin_url( '/' );
 * Or simply base the redirect on conditionals like 
 * is_*() functions, current_user_can( 'capability' ), globals, get_current_screen()...
 * 
 * @return void
 */
function wpse12535_redirect_sampleyour_unique_redirect_function ()
  { 

    exit( wp_redirect( home_url( '/' ) ) ); 

} 

add_action( 'template_redirect', 'wpse12535_redirect_sample''your_unique_redirect_function' );

I'd say template_redirect. But take a look at the Action Reference.

Example

Don't forget to exit() on redirect.

/**
 * This example redirects everything to the index.php page
 * You can do the same for the dashboard with admin_url( '/' );
 * Or simply base the redirect on conditionals like 
 * is_*() functions, current_user_can( 'capability' ), globals, get_current_screen()...
 * 
 * @return void
 */
function wpse12535_redirect_sample()
 {
    exit( wp_redirect( home_url( '/' ) );
}
add_action( 'template_redirect', 'wpse12535_redirect_sample' );

I'd say template_redirect. But take a look at the Action Reference.

Example

Don't forget to exit() on redirect.

/**
 * This example redirects everything to the index.php page
 * You can do the same for the dashboard with admin_url( '/' );
 * Or simply base the redirect on conditionals like 
 * is_*() functions, current_user_can( 'capability' ), globals, get_current_screen()...
 * 
 * @return void
 */
function your_unique_redirect_function () { 

    exit( wp_redirect( home_url( '/' ) ) ); 

} 

add_action( 'template_redirect', 'your_unique_redirect_function' );
added 48 characters in body
Source Link
kaiser
  • 50.8k
  • 27
  • 150
  • 244

I'd say template_redirect. But take a look at the Action Reference.

Example

Don't forget to exit() on redirect.

//**
 * This example redirects everything to the index.php page
// * You can do the same for the dashboard with admin_url( '/' );
// * Or simply base the redirect on conditionals like 
// * is_*() functions, current_user_can( 'capability' ), globals, get_current_screen()...
 * 
 * @return void
 */
function wpse12535_redirect_sample()
{
    exit( wp_redirect( home_url( '/' ) );
}
add_action( 'template_redirect', 'wpse12535_redirect_sample' );

I'd say template_redirect. But take a look at the Action Reference.

Example

Don't forget to exit() on redirect.

// This example redirects everything to the index.php page
// You can do the same for the dashboard with admin_url( '/' );
// Or simply base the redirect on conditionals like 
// is_*() functions, current_user_can( 'capability' ), globals, get_current_screen()...
function wpse12535_redirect_sample()
{
    exit( wp_redirect( home_url( '/' ) );
}
add_action( 'template_redirect', 'wpse12535_redirect_sample' );

I'd say template_redirect. But take a look at the Action Reference.

Example

Don't forget to exit() on redirect.

/**
 * This example redirects everything to the index.php page
 * You can do the same for the dashboard with admin_url( '/' );
 * Or simply base the redirect on conditionals like 
 * is_*() functions, current_user_can( 'capability' ), globals, get_current_screen()...
 * 
 * @return void
 */
function wpse12535_redirect_sample()
{
    exit( wp_redirect( home_url( '/' ) );
}
add_action( 'template_redirect', 'wpse12535_redirect_sample' );
added 513 characters in body
Source Link
kaiser
  • 50.8k
  • 27
  • 150
  • 244
Loading
Source Link
kaiser
  • 50.8k
  • 27
  • 150
  • 244
Loading