Comments (6)
Interestingly enough, it is 3 years later and ACF still does not support Relative links.
from acf.
Interestingly enough, it is 3 years later and ACF still does not support Relative links.
Nor should it, if the goal of that specific field type is to provide link format validation (which it presumably is), per the HTML5 specification, which states that the URL property of an HTML5 input (ie. <input type="url">
should have "A single properly-formed absolute URL" as its entry, for the input to be valid. @elliotcondon indicated as much in his response above.
from acf.
Hi @lordspace
Thanks for the request.
The HTML5 'url' input does not currently allow for a non 'http' links (relative url).
https://stackoverflow.com/questions/3670437/input-type-url-for-relative-urls
For now, I suggest using a basic text input which won't have any built in browser validation.
from acf.
from acf.
From: Eric Moore Why couldn't there be a toggle for which type you wanted the link to be? ACF seems to feel strongly about the absolute type, so that type could be the default selection.
Respectfully, Eric, I suspect that you're missing the point of the URL field. As far as I can tell, it's there SPECIFICALLY for when you need a simple URL field input with strict input format validation. So changing that behaviour would inherently defeat its entire purpose.
If you want a field for relative links, then you implicitly don't care about URL format validation for your use-case, and thus you have multiple other options at your fingertips:
- Use a "link" field type (that field provides the dual option of typing your own link and selecting from site posts/pages, and does support relative links — I just tested it to double check)
- Use relationship field to establish your in-site linking, and then resolve the link url in your template (this is actually a lot more robust than storing relative link values manually, since it's based on
post_id
, so if you move the URL/path to the relational target post/page, the resolved links will automatically change to reflect the new path). - Just use a plain text field (as @elliotcondon suggested three years ago)
Given the array of different ways to skin this cat: what's driving the fixation on having the URL field do something that it presumably wasn't designed to do?
from acf.
Probably could go ahead and mark this as closed.
from acf.
Related Issues (20)
- WYSIWYG Editor Field: Image element with width and height attributes triggers unsafe HTML error message HOT 4
- filter wysiwyg_tinymce_settings breaking HOT 1
- Front-end form submits itself when closing the wordpress link-edit dialogue
- Nested cloned repeater only works for 1 level
- Gallery - edit image breaks field in block sidebar HOT 1
- ACF 6.3.0 update breaks "No fields assigned" filter with empty string HOT 3
- Can't add ACF licence key HOT 1
- update_field() not working as expected in this scenario HOT 3
- Installing through composer installs incorrect version HOT 5
- Uncaught TypeError: Cannot access offset of type string on string - flexible content HOT 4
- Fix jQuery deprecations HOT 1
- User field stopped showing in GraphQL query
- Group: image subfield n°10 not working HOT 1
- PLEASE ADD A DISCLAIMER THAT SHORTCODES HAVE TO BE ENABLED NOW HOT 1
- Repeater field type with pagination HOT 1
- Conditional logic in the Advanced Field Settings broke when a wrapper was added v6.2.9.
- Ampersands in Text Area fields produce warnings HOT 5
- Duplicating Gutenberg blocks in edit mode erases data upon saving the post HOT 7
- Using Taxonomy field in Gutenberg panel, does not update Post URL
- acf_site_health error where use wp-cli search-replace HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from acf.