WordPress.org

Ready to get started?Download WordPress

Forums

Quick Page/Post Redirect Plugin
[resolved] Add redirect programatically? (2 posts)

  1. alxvallejo
    Member
    Posted 1 year ago #

    I'm trying to use this syntax but the url does not update:

    add_post_meta($ThisPageID, _pprredirect_active, 1, true);
    add_post_meta($ThisPageID, _pprredirect_type, 301, true);
    add_post_meta($ThisPageID, _pprredirect_url, 14417, true);

    The type and active work but not the url. This code is 'nasty' to go through. Any help?

    http://wordpress.org/extend/plugins/quick-pagepost-redirect-plugin/

  2. prophecy2040
    Member
    Plugin Author

    Posted 1 year ago #

    alexallejo,
    You can add data that way. It looks like you are trying to pass the post ID to the redirect URL, maybe? You have to pass a string to the URL.

    Try this,
    add_post_meta($ThisPageID, '_pprredirect_url', 'http://someurl.com/text/', true);

    The other two allow for numeric data (active is bool value, type is numerical).

    Sorry about the code being 'nasty', but is is very clean and almost everything is commented... but there IS a lot going on - it has to hook into a lot of different functions for the regular redirects and the Quick Redirects are an entire different thing - as they are separate from the individual ones. Additionally, there are a lot of checks that have to happen to make it all work correctly and a lot of crazy code to make it happen.

    Let me know if you have further issues and I will see what I can do to help. Email me directly (plugins@fischercreativemedia.com) for the fastest response.

    Warm regards,
    Don Fischer

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.