The File field’s documentation has some options you can try, but here’s an example if your field’s Return Value is array, where you can use $gradingForm['url']
to get the attachment URL:
$gradingForm = get_field( 'grading_form', $post_id );
echo $gradingForm ? '<a href="' . esc_url( $gradingForm['url'] ) . '">Grading Form</a>' : 'N/A';
And the proper way to use wp_get_attachment_url()
is by passing the attachment (post) ID as the only parameter like this: wp_get_attachment_url( 123 )
.
And in your case, here’s an example without using get_field()
:
$att_id = get_post_meta( $post_id, 'grading_form', true );
$gradingForm_url = wp_get_attachment_url( $att_id );
Related Posts:
- Adding ‘menu order’ column to custom post type admin screen
- Placing a Custom Post Type Menu Above the Posts Menu Using menu_position?
- How do I set the default admin sort order for a custom post type to a custom column?
- Custom Post Type Settings page, choose page to display archive
- Make custom column sortable
- Put update-like notification bubble on multiple CPTs menus for pending items
- Meta Boxes: ‘admin_init’ or ‘add_meta_boxes’ hook?
- Show Custom Taxonomy Inside Custom Menu
- Remove “posts” from admin but show a custom post
- Add “Last Edited by” column to custom post type list table
- Can I have Post Types under other Post Types in Admin menu?
- Is it OK to move admin menu items?
- Column sorting with emtpy meta values
- manage posts custom column is not populating data from meta boxes
- How Do I Programmatically Better Organize Custom Post Type Menus?
- Add Post type menu to another menu
- How do I create multiple post types in same menu section in WP-admin?
- Is there a way to keep a custom menu expanded when editing a custom post type?
- Menu position (admin menu) of pages
- Custom admin columns for ALL custom post types
- Remove Custom Post Type menu for non-administrator users.
- Add custom column to custom post type overview in backend
- How do I code access to the built-in UI of a CPT when it’s placed as submenu of another CPT that is protected by role?
- Custom Post Type, Two categories, Two columns with Pagination
- Replacing the title in admin list table
- How can I add columns to custom post tables
- Custom Post Type and taxonomies’s labels localization not working
- how to only have one custom post type post?
- Custom Post Types: Custom columns with Title submenu?
- How to show custom (checkbox) field value in admin post list?
- How to allow “Add New” capability of CPT when links to its UI are placed as a submenu?
- How to add new tab to admin list of posts and handle result list
- Custom post admin filtering by post meta (the date)
- Admin Column Text Positioning
- Displaying different custom post types under one admin menu
- Add Post Url to Manage Edit Screen
- Add management screens to post type
- Problem adding column to WC Subscription [closed]
- How to add custom post type under option page
- How to remove default tag and category options form a custom post type admin menu
- Prevent custom taxonomy from being added to admin menu?
- Trying to add script to specific admin page is not working
- How do increase the amount of links shown down the left in the admin menu?
- Move custom post menu to under plugin admin menu
- how to check if custom post type column already exists?
- Insert & order custom post types in/as submenu
- With two custom post types, how to make one a child of the other in the admin menu?
- Adding HTML tags or css classes to admin columns
- Extending AZIndex plugin to use custom post types and custom taxonomies
- Custom post types as sub menu pages and role capabilities issue
- WP CPT Custom Sortable Column in Admin Dashboard Sort Order Random
- How to show first name and last name in custom post type columns
- How to display Custom Taxonomy under Custom Admin Menu?
- Able to edit custom post, but unable to create new custom post when within submenu. What capability is missing?
- Possibilities for the edit.php admin panel? [closed]
- Add Custom Post type menu to another menu in specific location
- How to remove post listing page for a custom post type
- Order a custom post type admin screen by a second custom post type title
- 4 column-loop ordered alphabetically with entries grouped (and labeled) by their first letter
- Ordering Submenu Pages in WP 3.1
- Custom columns doesn’t appear in custom post type
- Problem with $post_id object’s property
- Conflict between Capabilities and Menu Visibility with Custom Post Types
- Pods CMS: How to add custom column to Adnvanced Content Type
- CPT Columns doesn’t show categories
- Using menu_position to add two entries between Dashboard and Posts
- How to add query args to links to CPT admin submenu
- Custom Columns for Custom Post Type Manager
- Reusable metabox backend and frontend
- Multiple custom post types showing up in edit.php
- admin_head-post.php only works after publish / update
- Custom sortable column with WPAlchemy
- Remove filter and view options from custom post type edit screen
- Sortable column with custom data by date
- Add Content Column to Custom Post Type backend
- Hide Published text from custom post types column
- custom filtering admin columns
- Cannot include custom post item within a menu
- How can i redirect click to new admin page not to edit screen in post table
- Is there a way to display a custom post type menu item as “users” submenu?
- Custom sorting in post columns by ACF Pro Select Field
- Subset of Custom Post Type From Admin Menu Based on Meta Data
- How to override post-new.php with custom template
- Setting up a page to house certain types of posts
- Changing menu label to post name for custom post type
- Columns depending on posts count
- Making my custom column sortable
- Show custom taxonomy not in submenu
- Duplicate “Pages” Item in Admin Menu
- How to avoid hardcoded text in a custom page template?
- Limit number of posts under a post type?
- Issue on CPT Custom Menu Position in WP
- Custom Taxonomy Showing in WP Menu
- Show custom taxonomies in admin panel under custom post type
- Split custom post list into two columns
- Add top-level menu pointing to a different custom post type?
- Separating a custom taxonomy from blog post-type
- wordpress custom post type shows other cpt posts in admin menu
- Custom post types not showing in the admin menu on production, but shows locally
- Admin menu link with variable