Loading forms using custom URLs

We already discussed the concept behind this technique in Chapter 6, Practical Usage of WordPress APIs, Rewrite API section. The shortcode method is not highly reliable for advanced web sites. So, we create our own URL structures and handle the forms using those custom URLs instead of using post, page, or custom post type. Since we already discussed this technique, we are going to go through the code without major explanations. Let's start by adding a new rewrite rule and a query parameter to handle frontend property creation:

add_action( 'init', 'wqcpt _manage_property_routes' );function wqcpt_manage_property_routes() { add_rewrite_rule( '^property-listing/([^/]+)/?', 'index.php?wpquick_property_actions=$matches[1]', ...

Get WordPress Development Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.