Title: GET arguments
Last modified: February 18, 2019

---

# GET arguments

 *  Resolved [paolofranzetti](https://wordpress.org/support/users/paolofranzetti/)
 * (@paolofranzetti)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/get-arguments/)
 * I have created a couple of custom functions in my functions.php to process a 
   GET argument and pass it to a page
 * add_filter( ‘query_vars’, ‘addnew_query_vars’, 10, 1 );
    function addnew_query_vars(
   $vars) { $vars[] = ‘account’; return $vars; } add_action(‘init’, ‘custom_rewrite_basic’);
   function custom_rewrite_basic() { add_rewrite_rule( ‘^staff/([^/]+)([/]?)(.*)’,‘
   index.php?pagename=staff&account=$matches[1]’, ‘top’ ); }
 * Within the page template I get the ‘account’ variable with
 * $account = get_query_var( ‘account’ )
 * However it stops working when I activate the Permalink Manager plugin. My guess
   is that the rewrite rules are overwritten by the plugin.
 * Is there a way to process GET variables within the Permalink Manager plugin ?
 * Thank you very much for any advice,
    Paolo
    -  This topic was modified 7 years, 3 months ago by [paolofranzetti](https://wordpress.org/support/users/paolofranzetti/).

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Plugin Author [Maciej Bis](https://wordpress.org/support/users/mbis/)
 * (@mbis)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/get-arguments/#post-11218174)
 * Hi Paolo,
 * could you send me a sample link where the query var is used? I will try to prepare
   a custom snippet to make it working.
 * Best Regards,
    Maciej
 *  Thread Starter [paolofranzetti](https://wordpress.org/support/users/paolofranzetti/)
 * (@paolofranzetti)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/get-arguments/#post-11218423)
 * This is the main page:
 * [http://test.lambrate.inaf.it/test/](http://test.lambrate.inaf.it/test/)
 * and this is the URL that does not work (it redirects on the main page)
 * [http://test.lambrate.inaf.it/test/paolo.franzetti](http://test.lambrate.inaf.it/test/paolo.franzetti)
 * The “explicit” URL works fine;
 * [http://test.lambrate.inaf.it/index.php?pagename=test&account=paolo.franzetti](http://test.lambrate.inaf.it/index.php?pagename=test&account=paolo.franzetti)
 * Below I attached the “test” page source.
 * This is the new site of my institute and it is password protected. I have created
   a temporary account for you;
 * Username: test
    Password: ioNChi
 * Thank you very much,
    Paolo
 * ————————————————————————
 *     ```
       <?php
       /**
        * Template Name: Staff Page Template
        *
        * Displays the Personal Page Template.
        *
        * @package ThemeGrill
        * @subpackage Spacious
        * @since Spacious 1.0
        */
       get_header(); ?>
   
       	<?php do_action( 'spacious_before_body_content' ); ?>
   
       	<div id="primary">
       		<div id="content" class="clearfix">
   
       	<?php
   
       		$name = get_query_var( 'account' );
   
       		if (strlen($name)!=0) {
   
       			  print "This will be the page for the " . $name . " account";
   
       			} else {
   
       				print "This will be the full staff page";
   
       			}
   
       	?>
   
       		</div><!-- #content -->
       	</div><!-- #primary -->
   
       	<?php spacious_sidebar_select(); ?>
   
       	<?php do_action( 'spacious_after_body_content' ); ?>
   
       <?php get_footer(); ?>
       ```
   
    -  This reply was modified 7 years, 3 months ago by [paolofranzetti](https://wordpress.org/support/users/paolofranzetti/).
    -  This reply was modified 7 years, 3 months ago by [paolofranzetti](https://wordpress.org/support/users/paolofranzetti/).
 *  Plugin Author [Maciej Bis](https://wordpress.org/support/users/mbis/)
 * (@mbis)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/get-arguments/#post-11218473)
 * Hi Paolo,
 * could you try to disable “Canonical redirect” in Permalink Manager settings?
 * Best regards,
    Maciej
 *  Thread Starter [paolofranzetti](https://wordpress.org/support/users/paolofranzetti/)
 * (@paolofranzetti)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/get-arguments/#post-11218487)
 * Disabled, but still not working.
 * Kind regards,
    Paolo
 *  Plugin Author [Maciej Bis](https://wordpress.org/support/users/mbis/)
 * (@mbis)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/get-arguments/#post-11218543)
 * Hi Paolo,
 * please add this code to your snippet:
 *     ```
       function pm_stop_redirect($request) {
       	if(!empty($request['account'])) {
       		$request['do_not_redirect'] = 1;
       	}
   
       	return $request;
       }
       add_filter('request', 'pm_stop_redirect', 999);
       ```
   
 * Best regards,
    Maciej
 *  Thread Starter [paolofranzetti](https://wordpress.org/support/users/paolofranzetti/)
 * (@paolofranzetti)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/get-arguments/#post-11218597)
 * I added the code in my “functions.php” (is this the right place?) but the direct
   URL still does not work.
 * Paolo
 *  Plugin Author [Maciej Bis](https://wordpress.org/support/users/mbis/)
 * (@mbis)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/get-arguments/#post-11218614)
 * Hi Paolo,
 * do you possibly have any staging website where I can test it? If so, please send
   me the credentials to my email: contact /at/ maciejbis.net.
 * Best regards,
    Maciej
 *  Thread Starter [paolofranzetti](https://wordpress.org/support/users/paolofranzetti/)
 * (@paolofranzetti)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/get-arguments/#post-11219056)
 * Trying to setup a staging website for you, I realized that your solution actually
   works if I use the “real” page. I am not sure why… perhaps the “test” slug is
   some kind of reserved name…
 * Anyway it works!
 * Thank you again very much,
    Paolo
 *  [Neotropic2023](https://wordpress.org/support/users/neotropic2023/)
 * (@neotropic2023)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/get-arguments/#post-11460055)
 * It helped my problem! Thanks!
 *     ```
       function pm_stop_redirect($request) {
       	if(!empty($request['account'])) {
       		$request['do_not_redirect'] = 1;
       	}
   
       	return $request;
       }
       add_filter('request', 'pm_stop_redirect', 999);
       ```
   

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘GET arguments’ is closed to new replies.

 * ![](https://ps.w.org/permalink-manager/assets/icon.svg?rev=2625166)
 * [Permalink Manager Lite](https://wordpress.org/plugins/permalink-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/permalink-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/permalink-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/permalink-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/permalink-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/permalink-manager/reviews/)

 * 9 replies
 * 3 participants
 * Last reply from: [Neotropic2023](https://wordpress.org/support/users/neotropic2023/)
 * Last activity: [7 years, 1 month ago](https://wordpress.org/support/topic/get-arguments/#post-11460055)
 * Status: resolved