Skip to content
Advertisement

WordPress custom field for multiple pages

I am using ACF pro for creating custom field for my wordpress website. I have a custom field in home page which I want to use in another three pages. Code I have given below.

JavaScript

Advertisement

Answer

In order to reference fields from another page, you need to include the post ID. This is similar to how you go about including fields from an Options page.

Example:

<p><?php the_field('field_name', 123); ?></p> Where 123 is the post ID.

For your example..

JavaScript

See https://www.advancedcustomfields.com/resources/how-to-get-values-from-another-post/ as a reference to this answer.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement