13th Feb '24
/
6 comments

Update Post Meta From Another Custom Field’s Value on Post Publish/Update when using Meta Box

Update Post Meta From Another Custom Field’s Value on Post Publish/Update when using Meta Box

In the Meta Box Facebook group a user asks:

Hi all, wondering if I can get some help. For custom field 1, I am using file_advanced to upload a PDF file.I am wondering if I can populate custom field 2 with the URL for the PDF file that was uploaded to custom field 1.

This Pro tutorial shows how we can extract the URL from a (PDF) file, a file_advanced type of custom field after a post has been saved (published or updated) and set it as the value of a field of url type (optional: read-only) for that post when using Meta Box.

Add the following in child theme's functions.php (w/o the opening PHP tag) or a code snippets plugin:

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Get access to all 610 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Pro
Conditionally outputting an element in a Query Loop based on date-type custom field

Conditionally outputting an element in a Query Loop based on date-type custom field

This Pro tutorial shows how to output an element in a Bricks' query loop only if the value of a date-type of custom field for…
Categories:
Pro
Meta Box Image Advanced Field Images in Bricks Query Loop

Meta Box Image Advanced Field Images in Bricks Query Loop

Updated on 3 Feb 2025 A user asked: Do you know what the best way to query an image from metabox gallery? I would like…
Categories:
Tags:
Output HappyFiles Folders in Metabox Select-Field

Output HappyFiles Folders in Metabox Select-Field

This tutorial is part of a series where I'm gonna show you how to output custom HappyFiles Galleries and Sliders. Part one will cover a…
Categories:
Pro
Meta Box Settings Fields in Bricks

Meta Box Settings Fields in Bricks

This Pro tutorial is the equivalent of our earlier ACF Options Fields in Bricks article but when using Meta Box. While retrieving the values of…
Categories:
Tags:
Pro
Dynamically Displaying Connected Content Offer Images in Bricks using Meta Box Relationship

Dynamically Displaying Connected Content Offer Images in Bricks using Meta Box Relationship

Consider the following scenario from a recent project I worked on. CPT 1: project CPT 2: content-offer Taxonomy for Projects: remodel-typeSample term names: Backyard Cottages…
Pro
Post Data for the Current User in Bricks with Meta Box

Post Data for the Current User in Bricks with Meta Box

How to configure a query loop to output the post data of the SalesRep CPT associated with the current user.
Categories:
Pro
Meta Box Checkbox List Query Type in Bricks

Meta Box Checkbox List Query Type in Bricks

This Pro tutorial provides the steps to add a new query type in Bricks builder for displaying the values of a Checkbox List type of…
Categories: