• PHP
  • WordPress
  • ACF

I really, really don’t like to store links to on-site content in the database: That’s a recipe for ending up with development or staging links in a production database. And you shouldn’t be linking to URLs for local content anyway: You should be linking to an identifier for that content.

Unfortunately, some things in WordPress are a little reluctant to let you do that so, Zelda tries to improve things: It lets you select the types of content you want to link to, allows a user to select what they want, but never stores that as a URL in the database (except for external links, obviously).

When you want to get a link, just do this:


This will echo out a full link element! If you don’t want that, just call get_field():

$url = get_field('example_zelda_field`);

That’ll return just the URL of whatever you want to link to.