ACF Custom Field Not Populating Title Meta

#63328
  • Resolved Anonymous
    Rank Math free

    Hi,

    I have an ACF field I’d like added into the meta title for a woocommerce taxonomy archive dynamically. From what I understood all I needed was to include %customfield(acf_fieldname)% and it would add the text – however, right now it appears as empty space?

    I’m probably missing something simple, but if you could let me know where I’m going wrong that would be great.

    Best,

    Liz

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    You must use the specific field names for the custom fields, if you are not sure, please consult your ACT support to help.

    If you already are, we might need to take a closer look at the settings. Please edit the first post on this ticket and include your WP logins in the designated Sensitive Data section.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping you.

    Anonymous
    Rank Math free

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    Allow me to consult on this with the dev team and will get back to you soon.

    Looking forward to helping you. Thank you.

    Hello,

    The customfield variable works only in the posts and also ACF stores value in a serialized format in Database so using %customfield(field_name)% variable will not work.

    To use ACF custom field value in Taxonomy title you can either create a new variable or you can use Rank Math’s title filter to dynamically change the value on the frontend.

    Following are the filters which you can use to register a new variable and to change the title value on the frontend:

    Register a new variable: https://rankmath.com/kb/filters-hooks-api-developer/#add-extra-variables

    Change title value on the frontend: https://rankmath.com/kb/filters-hooks-api-developer/#change-the-title

    I hope that helps.

    Anonymous
    Rank Math free

    Hi,

    Thanks for getting back to me. I’ve used the code you sent through but it doesn’t seem to be working still? The ACF field is still not appearing in the taxonomy title. Here’s my code

    add_action( ‘rank_math/vars/register_extra_replacements’, function(){
    rank_math_register_var_replacement(
    ‘seo_products’,
    [
    ‘name’ => esc_html__( ‘seo_products.’, ‘rank-math’ ),
    ‘description’ => esc_html__( ‘seo_products.’, ‘rank-math’ ),
    ‘variable’ => ‘seo_products’,
    ‘example’ => ‘seo_products_callback()’,
    ],
    ‘seo_products_callback()’
    );
    });

    Alberto
    Rank Math business

    Hello,

    It doesn’t work because you have to code the callback function. Here you have a thread where at the end you have a working code adding a custom var in Rank Math, so you can understand better how to set the callback function.

    Looking forward to help you.

    Anonymous
    Rank Math free

    Hi,

    Sorry I’m not sure what you mean by add the callback function? I thought all I had to do was add that snippet with the correct ACF field included – if there’s additional information needed perhaps you have a blog post or step by step on how to do it? I think a lot of people coming from Yoast will assume this feature is already built in so it would be helpful information to put out there.

    If you have an example of what the code should look like that would be really helpful.

    Best,

    Liz

    Hello,

    You should have your code in the following format.

    add_action( ‘rank_math/vars/register_extra_replacements’, function(){
    rank_math_register_var_replacement(
    ‘seo_products’,
    [
    ‘name’ => esc_html__( ‘seo_products.’, ‘rank-math’ ),
    ‘description’ => esc_html__( ‘seo_products.’, ‘rank-math’ ),
    ‘variable’ => ‘seo_products’,
    ‘example’ => ‘seo_products_callback()’,
    ],
    ‘seo_products_callback’
    );
    });
    
    //your callback function
    function seo_products_callback(){
      return 'seo_products';
    }

    Hope that helps. If you have any further question(s), please let us know. Thank you.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 8 replies - 1 through 8 (of 8 total)

The ticket ‘ACF Custom Field Not Populating Title Meta’ is closed to new replies.