Dynamic Routing in WordPress

  • Unknown's avatar

    Based on the path, I’m able to write custom routes to get the correct page, and set some custom variables… for example:

    If the route takes a URL in this format:

    http://example.com/products/:product_name

    And we hit this URL:

    http://example.com/products/baseball-glove

    And we’re able to retrieve the page by doing:

    get_page_by_path('products/product');

    Right now, the original query initially searches for products/baseball-glove which returns the WP_Post object for 404 / Page Not Found, even though my subsequent query with get_page_by_path gets me the correct WP_Post object. How can I reset the global $post object to overwrite the current WP_Post and so that other plugins are able to use functions like the the_title()?

  • Unknown's avatar

    What is the URL of the site your refer to?

    We require the exact URL of the site you are referring to so we can verify where it is hosted.

    We provide support only for wordpress.COM hosted blogs here. We do not provide support for wordpress.ORG software installs.

    WordPress.COM and WordPress.ORG are completely separate and have different username accounts, logins, features, run different versions of some themes with the same names, and have separate support documentation and separate support forums. Read the differences here http://en.support.wordpress.com/com-vs-org/

    If you are referring to a wordpress.ORG software install on paid hosting, and if you don’t have a username account at WordPress.ORG account, then click http://wordpress.org/support/ and register one on the top right-hand corner of the page that opens, https://wordpress.org/support/register.php so you can post to the support forums there.
    Resetting your WordPress.ORG password http://codex.wordpress.org/Resetting_Your_Password
    WordPress.org support docs are at https://codex.wordpress.org/Main_Page
    See also https://apps.wordpress.org/support/

  • The topic ‘Dynamic Routing in WordPress’ is closed to new replies.