The best thing to do here is use the tools that WordPress has provided for you to construct your URLs.
In this solution you’re building an array of URL parameters with keys and values, then you’re “attaching” these parameters to the array using add_query_arg
.
You can reuse this approach for all your URLs, and simply add/adjust your $parameters
array as you need it, and the URL.
$parameters = [
'event' => get_field( 'fl_name' ),
];
$final_url = add_query_arg( $parameters, site_url( '/enquiry/' ) );
then simply echo out your $final_url
wherever you need it:
<a href="<?php echo $final_url; ?>">Make a request</a>
A one-liner version of all of this is:
<a href="<?php echo add_query_arg( [ 'event' => get_field( 'fl_name' ) ], site_url( '/enquiry/' ) ) ;?>">Make a request</a>
Related Posts:
- Inserting Gravity Form checkbox values into Advanced Custom Fields [closed]
- The values of custom fields are not available functions.php
- Problem with ACF shortcode with Repeater Field in WordPress? [closed]
- ACF: how do I get the fields and its values of a specific group?
- Download PDF after CF7 form submission
- How to create an ACF shortcode with Repeater Field in WordPress? [duplicate]
- Show ACF field with link to ultimate member profile/WordPress user profile below the post (single post layout)
- How can I count ACF sub_field with a certain value
- Problem with adding custom CSS class to image in ACF Photo Gallery plugin [closed]
- Delete images from media library when user deletes an image from ACF Gallery
- Advance custom fields variable with if statement & Function
- PHP/CSS: Shortcode won’t display correctly, and only displays in the head (before content)
- Page returning ID from array, how to return the correct values for post in acf wordpress
- ACF Date fileds to Age Convert [closed]
- Custom WordPress Function – Adding items from Foreach Loop into an array and Updating Field based on array of IDs (ACF + WooCommerce)
- Creating posts with php-script + csv
- ACF number less than comparison not working
- Hide old attachments from wp media library
- PHP – redirect https to http and www to non-www
- Conditionally loading JavaScript based on the Advanced Custom Fields in the post
- How to overwrite youtube embed?
- Is there a reason why my wordpress PHP page isn’t loading into my PHP template
- Need to get specific data from array
- How to add SVG icon above product tab title
- Generating add_settings_section() calls dynamically
- Sort registered users by post count? (inside admin dashboard)
- How to change a public function inside a class of a plugin?
- Remove query string specific key value
- is_page “range” for if statement?
- Importing hard coded custom field into acf field
- WooCommerce – Reset quantity input field when variation changes
- Query all posts of a custom taxonomy term
- WordPress child theme fails to override parent navigation menu in /inc/structure/header.php
- Trying to establish connection to External Database
- Converting HTML Template to WordPress Theme
- Login/logout in header
- Error when adding excerpt to the content through functions.php
- Add data attribute to each li in menu
- Prev/Next child navigation for current page modifications?
- Adding rel tag to all external links
- Saving an array of dynamic repeater data as post_meta
- How can I apply_filters from inside a function?
- How to abort saving data in save_extra_profile_fields function WordPress?
- Slick + PHP + ACF + JQuery slide reveal not working
- Populate editor with some content of a page with a page template
- Get the date of the className or classID
- Way to add captions to gallery images by code
- WordPress Options Page Theory Question
- How to make container class in PHP
- How to show/hide php table rows based on the content of custom fields
- Prev/Next Links Broken on Static Front Page Pagination
- List all blogs, but exclude the main site
- Form search query – displaying ACF “Post Object” field as results
- Get ACF options field in PHP acting as CSS
- Reading settings in the home page precisely home.php
- Calling function in loop causes repeat data
- Is there a hack for using is_page() within the function.php file?
- Get All In One SEO Pack to use custom field instead of Content
- Add a select-option to the default widgets
- Programmatically revert to backup .htaccess a possibility?
- Execute PHP code only with specific user role
- WP-Bakery – Add custom colors to buttons with template colors
- WordPress User Meta value variable into Google Gauge Chart
- Problems updating nested ACF field groups
- Show all people who commented on all posts by an author
- PHP function for horizontal Woocommerce thumbnails and badges
- Trim Titles Only On Some Pages
- Custom global variable not working in function
- Embed video from streamtape using direct link
- Is there a PHP function that will return the block ID generated by WordPress?
- Creating a Function and Call It
- WooCommerce display price before add to cart [closed]
- Show sidebar only to author of post
- get_the_author_meta( ‘ID’ ) just return 1
- how to add custom select field to wordpress edit page
- Enqueue sripts and styles only if function is called
- Site title not showing. Please help me
- Check if post visited first time
- Store custom field’s multiple values in one user meta key
- Need to Echo A Url path to show on a wordpress page
- Theme editing “post thumbnail” help
- Restrict File Type Uploads by User on Wordress via functions.php
- How to Request a User to Register on Landing at a Site, Then Automatically Delete the Users Password on Logout?
- Matching multi user
- AJAX Returning Way Too Many Posts
- Where can I find the declaration of `$_wp_theme_features`?
- redirect 301 with special character like WIX site “#!”
- How I can add div to menu?
- Modify category archive page loop on functions.php
- How to print redirected query string variables to the page?
- Admin-area broken through weird issues
- Check if values exists DB
- How to get category pages to look like a certain archive page?
- How to call a specific value within the functions.php file?
- Select area and checkbox data is not saving?
- How to modify this function to exclude also the post belonging to a specific category?
- Order woo products, but first products must be with acf fields
- Suppress errors when using global function
- Alternative to php echo within code
- Add multiple HTML attributes to an Elementor button