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:
- Is It Possible To Add Custom Post Type Menu As Another Custom Post Type Sub Menu
- Adding ‘menu order’ column to custom post type admin screen
- Placing a Custom Post Type Menu Above the Posts Menu Using menu_position?
- Style custom columns in admin panels (especially to adjust column cell widths)
- 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
- Replacing the title in admin list table
- 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
- Custom sortable columns ordered by meta-value?
- Add “Last Edited by” column to custom post type list table
- Can I have Post Types under other Post Types in Admin menu?
- How to add custom columns to Custom Post Type admin screen
- 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
- order of date column in custom post type
- How to remove/hide elements from the admin menu?
- Remove Custom Post Type menu for non-administrator users.
- Add custom column to custom post type overview in backend
- custom sortable column
- 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
- Remove Post Page “View Post” Link
- 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?
- How can I use a different default admin menu icon for custom post type?
- 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?
- Adding menu_order to CPT admin page
- 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
- How do I sort a custom post type admin column using two meta keys?
- Add Post Url to Manage Edit Screen
- Add management screens to post type
- How do I alter the position of a Custom Post Type menu item within my plugin admin menu?
- 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
- Custom Post Type / Tab Limit
- rewrite custom post type slug in wp admin
- 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?
- Add Custom Post Type as top level menu item for a custom page
- 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
- WordPress make Grandparent and great grandparent filterable in custom columns
- 2 Different Custom Post Types in Submenu
- 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
- How can I use this code on a custom database table?
- How to group navigation items in the admin panel
- 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
- Make a custom column sortable by a value from a different custom post type
- Multiple custom post types showing up in edit.php
- Top level menu position overwrites another entry
- admin_head-post.php only works after publish / update
- Sorting custom post types in edit.php : Post disappear
- adding page types in menu
- Custom sortable column with WPAlchemy
- Admin menu link with variable
- Can’t add custom post type archive page to menu
- column values not showing after merging two custom post types
- One custom taxonomy with unique sets of labels for two post types?