WordPress.org

Ready to get started?Download WordPress

Forums

Quick Page/Post Redirect Plugin
[resolved] Is it possible to get the redirect URL in PHP (3 posts)

  1. skinnybloke
    Member
    Posted 4 months ago #

    Hi - I have this plugin set so that the original URL is shown NOT the Redirect URL for SEO and aesthetic reasons.

    Is it possible to get the redirect URL in PHP using something similar to 'get_page_link()'?

    I need to extract a variable value for some other processing.

    https://wordpress.org/plugins/quick-pagepost-redirect-plugin/

  2. prophecy2040
    Member
    Plugin Author

    Posted 4 months ago #

    If it is not a Quick Redirect, then you can get it from the Custom Fields like any other meta data.

    Inside the loop, you would use any of these to get the values you want:

    $pprRedUrl = get_post_meta($post->ID, '_pprredirect_url', true);
    $pprActive = get_post_meta($post->ID, '_pprredirect_active',true);
    $pprNewWin = get_post_meta($post->ID, '_pprredirect_newwindow',true);
    $pprNoFoll = get_post_meta($post->ID, '_pprredirect_relnofollow',true)
    $pprRewrit = get_post_meta($post->ID, '_pprredirect_rewritelink',true);
    $pprReType = get_post_meta($post->ID, '_pprredirect_type', true);

    Then you can check to see if a redirect is active, get the URL and do whatever, like so:

    if($pprActive == '1' && $pprRedUrl != ''){
       // now do something with $pprRedUrl if you need to
    }

    Warm regards,
    Don

  3. skinnybloke
    Member
    Posted 4 months ago #

    Brilliant! Thanks for that.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.