Asked  7 Months ago    Answers:  5   Viewed   30 times

I'm creating a customized WordPress theme based on an existing site.

I want to use an alternate dashboard which I have created.

How can I have the user directed to 'news.php' after login instead of '/wp-admin/' ?


EDIT: Have a working Plug-in for this but the bounty is still availible for anyone who can find a manual way to do this through functions.php, as it would be more secure then using a 3rd party plug-in.



This should solve your problem. Adapted from an answer found here.

Add the following snippet of code in the functions.php file of your theme:

function admin_default_page() {
  return '/new-dashboard-url';

add_filter('login_redirect', 'admin_default_page');
Wednesday, March 31, 2021
answered 7 Months ago

After looking inside zerif_customizer.js, I discovered that Zerif Lite is adding the widget panel sections to the Theme Customizer via JavaScript.

To do the same in a child theme of Zerif Lite...

In your functions.php file:

function mytheme_customizer_live_preview() {
        'mytheme-themecustomizer',                                  //Give the script an ID
        get_stylesheet_directory_uri() . '/js/theme-customizer.js', //Point to file
        array( 'jquery' ),                                          //Define dependencies
        true                                                        //Put script in footer?
add_action( 'customize_controls_enqueue_scripts', 'mytheme_customizer_live_preview' );

Then put a new JavaScript file in your theme, where the filename and path must match the second parameter from the function above:

jQuery(document).ready(function() {
    /* Move our widgets into the widgets panel */
    wp.customize.bind('ready', function() {
        wp.customize.section( 'sidebar-widgets-sidebar-mysection' ).panel( 'panel_mysection' );
        wp.customize.section( 'sidebar-widgets-sidebar-mysection' ).priority( '2' );

Of course, panel_mysection must already exist as per something like this:

$wp_customize->add_panel( 'panel_mysection', array(
    'priority' => 33,
    'capability' => 'edit_theme_options',
    'title' => __( 'Mysection section', 'mytheme' )

And the sidebar-mysection widget section must already exist:

class zerif_mysection extends WP_Widget {
    public function __construct() {
            __( 'Zerif - Mysection widget', 'zerif-lite' )
function mytheme_register_widgets() {
        array (
            'name'          => 'Mysection section widgets',
            'id'            => 'sidebar-mysection',
            'before_widget' => '',
            'after_widget'  => ''
add_action('widgets_init', 'mytheme_register_widgets');
Saturday, May 29, 2021
answered 5 Months ago

It worked fine after updating the search.php as following,



//Page Title Bar
$pageTitle = 'Search results for: "'.get_search_query().'"';
echo page_title_bar( $pageTitle, get_template_directory_uri().'/framework/assets/images/pg-title-bar.jpg');

<div class="container blog-wrapper page-container">
    <div class="row">
        <div class="col-lg-9 col-md-9 col-sm-12 col-xs-12">
            <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

                    // Include Blog Posts List
                    get_template_part('framework/template-parts/post/blog', 'post-list');

            <?php endwhile; ?>

            <div class="pagination-wrapper">
                <?php pagination(); ?>

            <?php else: ?>
                <h3>No results found for: '<?php echo get_search_query(); ?>'</h3>
            <?php endif; ?>

        <div class="col-lg-3 col-md-3 col-sm-12 col-xs-12">
                // Include Blog Sidebar
                get_template_part('framework/template-parts/post/blog', 'sidebar');

<?php get_footer(); ?>

If I get a reasonable and well described answer I can offer the bounty for that answer.

Saturday, May 29, 2021
answered 5 Months ago

Yes. You can use the target_path option. Using your example above:

            always_use_default_target_path: true
            default_target_path: /loggedinpage

With the above the user will always be redirected to /loggedinpage upon a successful login. Details of all the options for the security component are available in the Symfony docs (albeit slightly hidden away!)

Saturday, September 11, 2021
answered 1 Month ago


LOGIN_REDIRECT_URL = 'auth/logged_in'


LOGIN_REDIRECT_URL = '/auth/logged_in'

You're redirecting to a path that is appended to the current url. You need to use a leading slash to redirect to a path that is appended to the domain root.

Saturday, October 9, 2021
answered 1 Week ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :