How to stop WordPress from removing & from URL?

Here’s the why part: This part of the redirect_canonical() is removing the leading & in the redirect query part: // tack on any additional query vars $redirect[‘query’] = preg_replace( ‘#^\??&*?#’, ”, $redirect[‘query’] ); Example: example.tld/?&a=1&b=2&c=3 is redirected to example.tld/?a=1&b=2&c=3 If you must have the leading & you might try to adjust it through the redirect_canonical … Read more

pass user id in slug and get user information

The code seems incomplete. Maybe the problem is simply that you define $id but then try to use $user_id? Also, I think id is a protected variable, so maybe use my_id instead. Try this: www.mysite.com/test?my_id=123 $user_id = $_REQUEST[‘my_id’]; $camp_link = get_site_url().”/campaign-detail/?id=”.$user_id; echo “<p class=”campaign_store_name”><a href=””.$camp_link.””>”.$camp_title.”</a></p>”; $arform_id = Get_ARFORM_ID_using_slug($camp_link);

How to rewrite url wordpress?

You should hook add_rewrite_rule() into init Assuming http://local/rieltplus/ is your homepage, and category/catalog/ is a category archives, this should work: add_action(‘init’, function() { add_rewrite_rule( ‘category/catalog/([^/]+)?$’, ‘index.php?category_name=catalog&type=$matches[1]&price_min=1000&price_max=2000&area_min=5&area_max=50&room_num=5&etage=2&plan=old’, ‘top’ ); }); If you want to make that available to any category then mention it in the comments. By the way, local/rieltplus/category/catalog/TYPE&price_min is not a valid URL, unlike … Read more

How to redirect a page into file?

Recommend and currently use Quick Page/Post Redirect Plugin https://wordpress.org/plugins/quick-pagepost-redirect-plugin/ Request URL Destination URL /page/ http://example.com/uploades/file.pdf

Custom Post type and permalink settings

You can use the rewrite parameter to disable the front portion of the URLs (/academy/ in your case) for custom post types. function create_posttypes() { $labels1 = array( ‘name’ => __( ‘Definitions’ ), ‘singular_name’ => __( ‘Definition’ ), ‘all_items’ => __( ‘All Definitions’ ), ‘view_item’ => __( ‘View Definition’ ), ‘add_new_item’ => __( ‘Add New … Read more

Check request URL for pattern

how’s the URL structure? Could you paste here? If you’re URL follows this structure: http://example.com/?foo=bar, so you need to get the foo value with this: if ( isset( $_GET[‘foo’] ) ) { $bar_value = $_GET[‘foo’]; // Do whatever you want with $bar_value. } else { // Do something else. } If that doesn’t work, you … Read more

How do I write the link from front-page.php to home.php?

There really should be a simpler way to do it but you kind of need to know that WordPress stores both the Front Page ID and Blog Page ID in the options table. So, to get the URL of the blog you need to use both get_permalink() and get_option() in conjunction. <a href=”https://wordpress.stackexchange.com/questions/270158/<?php echo esc_url( … Read more