bp_profile_search_redirect_admin_screens()

BuddyBoss Profile Search admin redirect.

Description

Source

File: bp-core/profile-search/bps-admin.php

function bp_profile_search_redirect_admin_screens () {
    $redirect_to_main_form = false;
    
    $current_screen = get_current_screen();
    
    if ( 'edit-bp_ps_form' == $current_screen->id ) {
        $redirect_to_main_form = true;
    } else if ( 'bp_ps_form' == $current_screen->id && 'add' == $current_screen->action ) {
        $redirect_to_main_form = true;
    }
    
    if ( $redirect_to_main_form ) {
        $main_form = bp_profile_search_main_form();
        //create a form if not created already
        if ( !$main_form ) {
            bp_profile_search_add_main_form();
            $main_form = bp_profile_search_main_form();
        }
        
        //redirect to edit that form
        if ( $main_form ) {
            wp_redirect( admin_url( 'post.php?post=' . $main_form . '&action=edit' ) );
            die();
        }
    }
}

Changelog

Changelog
Version Description
BuddyBoss 1.0.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.