Search code examples
phpwordpresswordpress-plugin-creation

WP v-5.5 $_GET parameter does not work in my plugin


I have developed a wordpress plugin. In my plugin I manage all pages by get parameters like (http://example.com/client-portal/?page=dashboard) and it was working till wordpress version 5.4

But new version of wordpress version 5.5 in automatically redirect http://example.com/client-portal/?page=dashboard to http://example.com/client-portal/. Get parameter vanished automatically.

I have added shortcode by this way -

//page short code for user page
add_shortcode( 'ccgclient_portal', array($this,'ccgclient_portal_shortcode_func') );

This is my shortcode function -

function ccgclient_portal_shortcode_func()
{
    ob_start();
    include_once 'pages/user/index.php';
    return ob_get_clean();
}

And catch get parameters by -

if(isset($_GET['page']) && $_GET['page'] == 'dashboard'){
     include_once 'dashboard.php';
}

I don't know what's wrong with the new version of wordpress (5.5).

Please can you help me ?

Thanks in advance.


Solution

  • I believe your issue is with the 'page' key, this is a post type slug and it's creating a conflict with WP in this version. This is the same as configuring the permalink to work with '?post=98979' or a similar format. My suggestion is to try and use a different get key and see what happens.

    Let me know what you get.