Title: Shortcode in restrict message
Last modified: October 24, 2018

---

# Shortcode in restrict message

 *  Resolved anonymized-13996578
 * (@anonymized-13996578)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/shortcode-in-restrict-message/)
 * Hello. I would like to add a shortcode in the restrict message, but the options
   i’ve tried doesn´t work.
 * Thanks.
 * Regards.

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

 *  Moderator [Pippin Williamson](https://wordpress.org/support/users/mordauk/)
 * (@mordauk)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/shortcode-in-restrict-message/#post-10811238)
 * Could you please show me an example of what you’re trying and what the results
   are?
 *  Thread Starter anonymized-13996578
 * (@anonymized-13996578)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/shortcode-in-restrict-message/#post-10811722)
 * Yeah sure.
 * The page is this: [https://viajarandroll.com/curso/cicloturismo/capitulo-1-la-bicicleta/](https://viajarandroll.com/curso/cicloturismo/capitulo-1-la-bicicleta/)
 * As you can see in the pink box, the first link is to enter the web. However, 
   this link changes depending on each page of the web (I am using the Genesis modal
   login login box), adding to the url / # login. So I have created a shortcode 
   that takes out the URL from the page the user is on, and adds the previous parameter.
   But when I try to add the shortcode to the restriction message, it does not appear.
 * I leave you the shortcode code too.
 *     ```
        function shortcode_login() {
           global $wp;
           $current_url = home_url( add_query_arg( array(), $wp->request ) );
   
       	echo '<a href="'. $current_url . '">' . $current_url . '</a>';
   
       }
       add_shortcode('db-login', 'shortcode_login');
       ```
   
 * I hope to have explained.
 * Thanks, and greetings
 *  Moderator [Pippin Williamson](https://wordpress.org/support/users/mordauk/)
 * (@mordauk)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/shortcode-in-restrict-message/#post-10813609)
 * I see the log in links on the page and they redirect to the log in page.
 * Is that not what is supposed to happen?
 *  Thread Starter anonymized-13996578
 * (@anonymized-13996578)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/shortcode-in-restrict-message/#post-10814034)
 * Hi, Pippin.
 * It is not the behavior it should have.
 * As you say, open a modal box but on the home page. And this should open on the
   page where this log in is.
 * I give you examples:
 * For [https://viajarandroll.com/curso/cicloturismo/capitulo-1-la-bicicleta/](https://viajarandroll.com/curso/cicloturismo/capitulo-1-la-bicicleta/)
   the log in URL must be [https://viajarandroll.com/curso/cicloturismo/capitulo-1-la-bicicleta/#login](https://viajarandroll.com/curso/cicloturismo/capitulo-1-la-bicicleta/#login).
 * For [https://viajarandroll.com/curso/cicloturismo/capitulo-2-accesorios-y-portabultos/](https://viajarandroll.com/curso/cicloturismo/capitulo-2-accesorios-y-portabultos/)
   the log in URL must be [https://viajarandroll.com/curso/cicloturismo/capitulo-2-accesorios-y-](https://viajarandroll.com/curso/cicloturismo/capitulo-2-accesorios-y-)
   portabultos / # login.
 * For [https://viajarandroll.com/curso/cicloturismo/capitulo-3-las-alforjas/](https://viajarandroll.com/curso/cicloturismo/capitulo-3-las-alforjas/)
   the log in URL must be [https://viajarandroll.com/curso/cicloturismo/capitulo-3-las-alforjas/#login](https://viajarandroll.com/curso/cicloturismo/capitulo-3-las-alforjas/#login).
 * For [https://viajarandroll.com/curso/cicloturismo/capitulo-4-antipinchazos-sistemas/](https://viajarandroll.com/curso/cicloturismo/capitulo-4-antipinchazos-sistemas/)
   the log in URL must be [https://viajarandroll.com/curso/cicloturismo/capitulo-4-antipinchazos-systems/#login](https://viajarandroll.com/curso/cicloturismo/capitulo-4-antipinchazos-systems/#login).
 * For this I have created a shortcode that takes the URL of the page on which it
   is user, and adds the parameter. But the restriction message does not show me
   the shortcode.
 * It’s hard to explain when it’s not your language. I hope that with examples you
   understand me.
 * Thanks for the patience, greetings.
 *  Moderator [Pippin Williamson](https://wordpress.org/support/users/mordauk/)
 * (@mordauk)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/shortcode-in-restrict-message/#post-10815517)
 * Does your short code work (and open the modal) when not used in the [restrict]
   shortcode?
 *  Thread Starter anonymized-13996578
 * (@anonymized-13996578)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/shortcode-in-restrict-message/#post-10815560)
 * You can watch it here: [https://viajarandroll.com/prueba/](https://viajarandroll.com/prueba/).
 * The code is this:
 *     ```
        function shortcode_login() {
           global $wp;
           $current_url = home_url( add_query_arg( array(), $wp->request ) );
   
       	echo '<a href="'. $current_url . '/#login">Login</a>';
   
       }
       add_shortcode('db-login', 'shortcode_login');
       ```
   
 *  Thread Starter anonymized-13996578
 * (@anonymized-13996578)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/shortcode-in-restrict-message/#post-10821132)
 * I just solved it. As simple as putting it like this:
 * [this link](https://wordpress.org/support/topic/shortcode-in-restrict-message/?output_format=md#login)
 * Thank you very much for the great support.
 * A greeting.
 *  Moderator [Pippin Williamson](https://wordpress.org/support/users/mordauk/)
 * (@mordauk)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/shortcode-in-restrict-message/#post-10821902)
 * Glad to hear it!

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

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

 * ![](https://ps.w.org/restrict-content/assets/icon.svg?rev=3529325)
 * [Membership Plugin - Kadence Memberships](https://wordpress.org/plugins/restrict-content/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/restrict-content/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/restrict-content/)
 * [Active Topics](https://wordpress.org/support/plugin/restrict-content/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/restrict-content/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/restrict-content/reviews/)

 * 8 replies
 * 2 participants
 * Last reply from: [Pippin Williamson](https://wordpress.org/support/users/mordauk/)
 * Last activity: [7 years, 7 months ago](https://wordpress.org/support/topic/shortcode-in-restrict-message/#post-10821902)
 * Status: resolved