• Resolved scooterlord


    Hello and thank you for this wonderful plugin!

    I am trying to use ACF fields for the meta description using the following snippet:


    The ‘classified_condition’ field is a select that contains both label AND value (like label:value). I want to show the value, however, I see the label. Is there a way around this?

    Thanks for your time!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Rank Math


    Hello @scooterlord,

    Thank you for contacting the support and sorry for not following up quickly and any inconvenience that might have been caused due to that.

    The custom field variable will not work on the ACF fields because of the way ACF stores values in the post meta table.

    They store values in a serialized format for groups and for other fields they store key-value pair.

    You can register a new variable using the following filter to get the value from the ACF field:

    This is how we register the WooCommerce variable in the Rank Math plugin:

    Hope that helps.

    Thread Starter scooterlord


    Hello and I also apologize for not replying any sooner.

    I can’t really understand what the suggestion is. Is it possible that you can elaborate with an example?

    Plugin Author Rank Math


    Hello @scooterlord

    Here’s the link to the example code:

    Here is the simplified version of the code:

    add_action( 'rank_math/vars/register_extra_replacements', function() {
    			'name'        => esc_html__( 'Variable Name.', 'rank-math' ),
    			'description' => esc_html__( 'Variable Description.', 'rank-math' ),
    			'variable'    => 'acf_field_variable',
    			'example'     => get_acf_field_value(),
    } );
    function get_acf_field_value() {
    	global $post;
    	return get_field( 'acf_field_key', $post->ID );

    In the Variable dropdown, you will see the variable name after adding the filter code.

    In the above code, the variable dropdown will show %acf_field_variable%

    If you are still unsure, we would recommend hiring a freelancer or a developer to help you with the code.

    Hope that helps. Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.