acf options page get field code example

Example 1: acf options page

if( function_exists('acf_add_options_page') ) {
	
	acf_add_options_page();
	
}

Example 2: acf get field

get_field($selector, [$post_id], [$format_value]);
/*
$selector (string) (Required) The field name or field key.
$post_id (mixed) (Optional) The post ID where the value is saved. Defaults to the current post.
$format_value (bool) (Optional) Whether to apply formatting logic. Defaults to true.
*/
// Get a value from the current post
$value = get_field( "text_field" );
// Get a value from a specific post
$value = get_field( "field_name", $post_id );

Tags:

Php Example