Title: Shortcode in post
Last modified: May 1, 2018

---

# Shortcode in post

 *  [dunrar](https://wordpress.org/support/users/dunrar/)
 * (@dunrar)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/shortcode-in-post/)
 * Hi!
 * I’m using the Ultimate Member plugin and tried to use your plugin in one of the
   tabs. The users are being displayed, but when I try to search for a user, it 
   redirects me to the standart tab. I think the tabs might be saved as posts themselves,
   maybe that is a problem? The url of the tab goes like this:
    `http://192.168.100.88/
   hp1/user/erikamuster/?profiletab=staffoverviewtab` When I search for somebody,
   it redirects me to something like this: `http://192.168.100.88/hp1/user/erikamuster/?
   as=erik`
 * Do you have an idea how to fix that? Maybe change the
    `$search = ( get_query_var('
   as' ) ) ? get_query_var( 'as' ) : '';` or the `<form method="get" id="sul-searchform"
   action="<?php the_permalink() ?>">` line in the `search-author.php` file? The
   permalink is `http://192.168.100.88/hp1/user/`
 * Tanks in advance!
    -  This topic was modified 8 years, 1 month ago by [dunrar](https://wordpress.org/support/users/dunrar/).

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

 *  Plugin Author [HelgaTheViking](https://wordpress.org/support/users/helgatheviking/)
 * (@helgatheviking)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/shortcode-in-post/#post-10237424)
 * I don’t know anything about the Ultimate Member plugin. But, if `http://192.168.100.88/
   hp1/user/erikamuster` is the page you are on then that’s `the_permalink()`. Looking
   at it now, I’m not sure it needs to have an action. You could try overriding 
   the `search-author.php` template in your theme (see the [FAQ](https://wordpress.org/plugins/simple-user-listing/#how%20can%20i%20customize%20the%20output%3F))
   and removing the action.
 *     ```
       <form method="get" id="sul-searchform" action="">
       ```
   
 * Let me know if that works as I should probably adjust the plugin. If that doesn’t
   work, you could also try manually setting the URL you need.
 *     ```
       <form method="get" id="sul-searchform" action="http://192.168.100.88/hp1/user/">
       ```
   
 * I hope that helps!
 *  Thread Starter [dunrar](https://wordpress.org/support/users/dunrar/)
 * (@dunrar)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/shortcode-in-post/#post-10239948)
 * I tried both but still got redirected to the standart tab (which is being displayed
   if you open the user page)
    `http://192.168.100.88/hp1/user/erikamuster/?as=erik`
   instead of `http://192.168.100.88/hp1/user/erikamuster/?profiletab=staffoverviewtab/?
   as=erik` or something similar. When I print out the_permalink() on the staffoverviewtab,
   I get `http://192.168.100.88/hp1/user/` not `http://192.168.100.88/hp1/user/erikamuster/?
   profiletab=staffoverviewtab` I also tried `<form method="get" id="sul-searchform"
   action="?profiletab=taskoverviewtab/">` but still got redirected. Same thing 
   if I use the pagination to go to the next page. When I make staffoverviewtab 
   my standart tab, an empty action does work though.
    -  This reply was modified 8 years, 1 month ago by [dunrar](https://wordpress.org/support/users/dunrar/).
    -  This reply was modified 8 years, 1 month ago by [dunrar](https://wordpress.org/support/users/dunrar/).
    -  This reply was modified 8 years, 1 month ago by [dunrar](https://wordpress.org/support/users/dunrar/).
    -  This reply was modified 8 years, 1 month ago by [dunrar](https://wordpress.org/support/users/dunrar/).
    -  This reply was modified 8 years, 1 month ago by [dunrar](https://wordpress.org/support/users/dunrar/).
 *  Plugin Author [HelgaTheViking](https://wordpress.org/support/users/helgatheviking/)
 * (@helgatheviking)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/shortcode-in-post/#post-10241237)
 * > When I make staffoverviewtab my standart tab, an empty action does work though.
 * I kind of think the action should always be blank. Not sure when I’ll get to 
   test that out, but it might be a good change for a future version. `the_permalink()`
   is too restrictive as a URL and will always delete any custom URL args.
 * Pretty much the exact same issue with pagination, see [`get_previous_users_url()`](https://github.com/helgatheviking/Simple-User-Listing/blob/master/simple-user-listing.php#L444)
   and [`get_next_users_url()`](https://github.com/helgatheviking/Simple-User-Listing/blob/master/simple-user-listing.php#L475)
 *  Plugin Author [HelgaTheViking](https://wordpress.org/support/users/helgatheviking/)
 * (@helgatheviking)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/shortcode-in-post/#post-10241287)
 * You may need to add some allowed search variables via the `sul_user_allowed_search_vars`
   filter. Otherwise, the params get removed. I wrote this a few years ago now, 
   and I don’t really know how necessary it is to limit the vars in the way that
   I am. Like, so what if they are there?
 * This may help with the search redirection. It may not, I’m not sure yet.
 *     ```
       function helga_add_allowed_search_var( $vars ) {
       	$vars[] = 'profiletab';
       	return $vars;
       }
       add_filter( 'sul_user_allowed_search_vars', 'helga_add_allowed_search_var' );
       ```
   
 *  Thread Starter [dunrar](https://wordpress.org/support/users/dunrar/)
 * (@dunrar)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/shortcode-in-post/#post-10244597)
 * Okay, I see. Still, adding allowed search variables did not help me so far. Just
   pasted your code into the `search-author.php`, but still got redirected. Any 
   other ideas for allowed search variables? Or in general?
 * Thanks in advance!
 *  Plugin Author [HelgaTheViking](https://wordpress.org/support/users/helgatheviking/)
 * (@helgatheviking)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/shortcode-in-post/#post-10252172)
 * I looked at this today and I think that it is the nature of the GET type of form
   being used. A GET type form will encode all the inputs into the URL. By default,
   only the `as` parameter is an input in the form. Therefore the submit result 
   is always `http://192.168.100.88/hp1/user/erikamuster/?as=erik` until you add
   more inputs.
 * So I *think* you would need to pass a hidden parameter in the form such as
 * `<input type="hidden" name="profiletab" value="staffoverviewtab"/>`
 * to have the resulting URL be `http://192.168.100.88/hp1/user/erikamuster/?profiletab
   =staffoverviewtab/?as=erik`
 * You may need to use PHP to dynamically set that value, I don’t know how the Members
   tabs work.
 * Then please give my Dev version of the plugin a try:
    [https://github.com/helgatheviking/simple-user-listing/tree/dev](https://github.com/helgatheviking/simple-user-listing/tree/dev)
 * I am hoping that fixes the next/prev links. If you could test it on multisite
   that would be huge, but even testing on a single install will help.
 *  Thread Starter [dunrar](https://wordpress.org/support/users/dunrar/)
 * (@dunrar)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/shortcode-in-post/#post-10262213)
 * Okay, that was it! Thank you very much! Sadly I can try it only on one site, 
   but i’ve tried it with different tabs and it worked. I’ll probably use PHP to
   set the value of the parameter automatically once I’ve figured out how to get
   the name of the tab. Haven’t yet hade the chance to try the Dev version or to
   fix the next/prev links, but once I have, I’ll inform you how it went.
 * Still, thanks again already!
 *  Plugin Author [HelgaTheViking](https://wordpress.org/support/users/helgatheviking/)
 * (@helgatheviking)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/shortcode-in-post/#post-10263106)
 * You’re welcome. Please let me know how the dev version goes.

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

The topic ‘Shortcode in post’ is closed to new replies.

 * ![](https://ps.w.org/simple-user-listing/assets/icon-256x256.png?rev=3061308)
 * [Simple User Listing](https://wordpress.org/plugins/simple-user-listing/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simple-user-listing/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simple-user-listing/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-user-listing/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-user-listing/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-user-listing/reviews/)

 * 8 replies
 * 2 participants
 * Last reply from: [HelgaTheViking](https://wordpress.org/support/users/helgatheviking/)
 * Last activity: [8 years, 1 month ago](https://wordpress.org/support/topic/shortcode-in-post/#post-10263106)
 * Status: not resolved