You’re testing if assigning a value to $mylink
was successful in the if
statement rather than testing if it’s empty.
Try something like:
<?php
$article_link = get_field('article_link');
if( $article_link['url'] ): ?>
<a href="https://wordpress.stackexchange.com/questions/246505/<?php echo $article_link["url']; ?>"><?php echo $article_link['title']; ?></a>
<?php endif; ?>
See Example 1 in the ACF docs.
Related Posts:
- How to add a custom field in the advanced menu properties?
- Sortable Custom Columns in User Panel (users.php)?
- Importing data for advanced custom fields plugin?
- Gutenberg add a custom metabox to default blocks
- How to rename a custom field?
- Filter post listing by meta value which is a date
- Extra profile field as select box?
- Matching Serialized Arrays with meta_query
- Adding Custom Field to Taxonomy Input :Panel
- How to activate “custom fields” section in WP3
- How to filter or search the posts using postmeta tables custom meta fields with wordpress REST API
- Add meta data to the menu
- Custom bulk action for media gallery items
- Copy SEO Meta Desc “Custom Field” to Excerpt field?
- Custom fields won’t display on my blog page
- How to customize default wordpress editor?
- Order Custom post type loop by custom field (datepicker)
- Localized Date Format for Custom Field
- Add an advert every nth Paragraph
- Check if the value of a field has changed on save_post
- How to edit multiple post with Custom fields
- Undefined index error when saving content on metabox
- Saving custom image meta fields
- How to update custom user meta field in wp?
- Query post order by post and desc not working
- If category then echo a custom fields
- How can I show custom fields in the loop only to specific user roles?
- Add conditional custom option to ‘Display name publicly as’ dropdown
- Custom fields not getting saved in the databse when added to the add new user profile page
- I want to send an email when each post is published
- Show 1 post and after a specific date show the next one
- How to Create Dynamic Fields in a Meta Box?
- Sort custom field by post
- How to order posts by one custom field and filter them by another one?
- Can we create a WordPress read-only virtual field derived from three other fields?
- How to create a gallery custom field for WordPress post?
- How to display image inside container of custom made widget
- Can I create a template or doctype for my blog site?
- List users by sum of all their posts’ custom field values
- Custom Metabox additional item
- How to combine custom fields to make one order-able value
- Duplicate (or more) custom fields on many posts. Is there an easy way to clean them up?
- How to add new field to the account address?
- Split the_title
- Sort WP_Query with numeric custom field
- Display Multiple Values of Same Key
- How to Wrote Simple Calculations by Using Custom Fields in Loop?
- Custom Query based on custom field of a single post
- How can I use custom properties to set different background on different pages?
- change order of images attached to post
- Loop through incrementing custom fields
- Enable a short code in the custom meta field
- tax query between operator like
- The conditional logic only works to show or hide?
- Single page WordPress website – custom fields or meta boxes or something else?
- Collect Data from NEXT item while in loop
- Order custom fields alphabetically
- Custom product fields in wp e-Commerce plugin [closed]
- How to query for posts with either one or another custom field
- How show post only from after custom date
- How to add extra field in admin comment section
- wordpress multi user question
- How to sort post listing on a page using custom field value?
- Odd functions.php issue in WordPress
- Filter or order based on custom field
- Type character in name and make it invisble
- How to set up page fields with gutenberg instead of ACF
- ACF multi taxonomy on filterable gallery
- How to improve my non-unique metadata MySQL entries?
- How to use ACF with javascript to update custom field values?
- Custom user registration fields in user_register hook
- Unable to change checkout placeholder text
- Store comment form custom field in custom database
- Custom Fields Not Showing (ACF not installed)
- Show Custom field value instead of title in WP Menu
- How to add code to custom field to every blog post via php?
- How do I update custom field post meta in frontend post template?
- Sorting post by custom fileds date
- Query multiple meta values at the same time :
- How to Find List of Available Custom Fields for Theme?
- Getting user’s data, by custom field lookup (meta)
- get wordpress post loop by meta box date
- Sort posts by custom fields with empty values
- Custom Fields Not Working In Footer
- Delete custom meta
- Filter and display a specific custom field value [closed]
- Is it possible in WordPress
- Related post thumbnail not showing up
- Edit different parts of a page seperately
- Get multiple posts with some custom fields efficient
- I want my post to republish again after adding a custom field
- Custom fields: dropdown values depending on other custom field value
- How do i get a specific user metadata using custom metavalue outside of wordpress?
- Custom fields / meta box output
- Creating an If/Else statement using WPAlchemy MetaBox radio boxs
- How to retrive Custom Fields as Values for a Form field
- Get single image from custom fields made with WCK custom fields creator
- Media Custom Fields – get a value with PHP
- How to add google map to custom field
- jaredatch metaboxes on video post formats