• Is is possible to include shortcodes in URLs? I’m trying to output Query Parameters for specific Custom Post Types. For instance I have “communities” as a custom post type and I have a form at the bottom of all the individual community posts that I want to pre-populate a select field. I want the query parameter to be dynamically added to the URL via the shortcode I created that outputs the SLUG from the permalink. Since the forms “value” has to have a format with a dash and no spaces I couldn’t just output the title. However, that being said, the shortcode will not render in the Redirection plugin settings.

    Any way to get the shortcode to output the slug??? This way I can dynamically generate my redirects for all communities. I don’t want to have to create and manage over 13 URLs.

    Here’s a screenshot of my setup: https://prnt.sc/iMqFYpDl6VWP

    I verified, my shortcode is working great when I display it on a post or page in WP.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author John Godley

    (@johnny5)

    No, you can’t use a shortcode in a redirect. You may be able to use a regular expression:

    https://redirection.me/support/redirect-regular-expressions/

    Thread Starter Why Not Advertising, LLC

    (@whyknott)

    Ok thanks John, Well, Regular Expressions are over my head. I have no idea how to make what I outlined happen. Any ideas? Maybe using redirection plugin is not the answer. Perhaps it’s best done through Javascript? I don’t know. I’m not an expert programmer.

    Thanks,
    Kenny

    Plugin Author John Godley

    (@johnny5)

    I don’t fully understand what you are trying to do and can only help with Redirection itself. You mentioned a dropdown box and that doesn’t really have anything to do with redirecting things.

    If you only have 13 URLs then I would just just create one for each – it’s considerably less work than the other options.

    Thread Starter Why Not Advertising, LLC

    (@whyknott)

    Gotcha, I’m trying to automatically add query parameters dynamically to the URL. The parameters are specific to a select field in my form I plan to add on the same page. So I was trying to setup the query parameter to automatically update based on the post url that is tied to a custom post type in WordPress..

    For example:

    Regular URL:
    https://jamyershomes.com/new/communities/cherry-tree/

    URL with Query Parameter:
    https://jamyershomes.com/new/communities/cherry-tree/?community=Cherry-Tree-Community

    If you scroll all the way to the bottom of the page when you click the URL with the Query parameter added, I have a form that is revealed when you click on the Send Me a Message button under the sales manager section. The drop down select box for “Select a Community of Interest” is then automatically selected.

    This functionality is perfect, except that if I used REDIRECTION plugin then I’d have to create and manage all the URL redirects to the query parameter version manually when new communities are created or if something changes. This is not ideal, so I was trying to create a dynamic redirect that would pull in the community posts SLUG because that matches the name of the select field ID of the form.

    commnunity is the name of the Custom post type so that will not change it’s the ending part that will based on the community page that is being visited.

    Hope this makes sense.

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

The topic ‘Shortcodes in Redirects’ is closed to new replies.