Asked  8 Months ago    Answers:  5   Viewed   53 times

I have a website, with a user system. I want to integrate wordpress's user system into that website's, but I still want to use the website's register/login pages. I don't want anybody to be able to login or register using Wordpress's login or registration forms. Instead, when they're try to access the login/registration pages in Wordpress, I want those pages to redirect them to my own login/registration pages.

Is there any way of doing this? I've tried Google, but all I could find was redirection AFTER the user logs in or registers, which is not what I want.

Thank you in advance.



For this you need to redirect login/registration page to your custom pages. So, Write this code in your functions.php file Under your activated theme folder. Pass your custom page path as a Argument.


function possibly_redirect(){
 global $pagenow;
 if( 'wp-login.php' == $pagenow ) {
Wednesday, March 31, 2021
answered 8 Months ago

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 8 Months ago

I don't think it supports Twig templates but for sure you can write your custom Template class to render the pagination however you want.

Let's say in your AppBundle, you will need to create MyCustomTemplate class which should extend PagerfantaViewTemplateDefaultTemplate:


namespace AcmeAppBundleTemplate;

use PagerfantaViewTemplateDefaultTemplate;

class MyCustomTemplate extends DefaultTemplate
    // override whatever you need here ...

then register it in your services.yml file together with the view service:

        class: AcmeAppBundleTemplateMyCustomTemplate

        class: PagerfantaViewDefaultView
        public: false
            - "@acme_app.template.my_template"
        tags: [{ name: pagerfanta.view, alias: my_template }]

then in your Twig templates you will be able to use:

{{ pagerfanta(my_pager, 'my_template') }}

which will result in displaying your custom pagination template.

Wednesday, March 31, 2021
answered 8 Months ago

Im not sure didnt test but you can use user roles with if else statement

function redirect_after_logout() {
    if (!current_user_can('manage_options')) { 
        $url = '/';
    } else { 
        $url = 'member-login?logged_out=true';
    $redirect_url = home_url( $url );
    wp_safe_redirect( $redirect_url );
add_action( 'wp_logout', array( $this, 'redirect_after_logout' ) );
Saturday, May 29, 2021
answered 5 Months ago

you using getUrl and getBaseUrl and it's the same thing, you can use this code:


but u have extends Mage_Adminhtml_Controller_Action on your class. its the best way. if isn't a controller so u shouldn't do this redirect.

Saturday, May 29, 2021
answered 5 Months 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 :