I got this it to work thru paying for custom programming for it AND then fixed it myself to have it work correctly.
Use following code inside of Yoast Meta Title and meta Description fields inside of pages/posts:
%%VariableName%%
I have only tested this with TEXT field in ACF PRO.
Below is what goes into Functions.php
if( function_exists('acf_add_options_page') ) {
acf_add_options_page();
}
$seo_variables = get_fields('options');
if ( function_exists('get_fields') ){
if( $seo_variables ) {
$seo_variables_array = array();
foreach( $seo_variables as $name => $value ):
$seo_variables_array[$name] = $value;
endforeach;
}
}
function ss_get_all_values($var1){
global $seo_variables_array;
// echo($seo_variables_array[$var1]);
return $seo_variables_array[$var1];
}
function ss_register_custom_yoast_variables() {
$seo_variables = get_fields('options');
if ( function_exists('get_fields') ) {
if( $seo_variables ) {
$seo_variables_array = array();
foreach( $seo_variables as $name => $value ):
wpseo_register_var_replacement( $name, 'ss_get_all_values', 'advanced');
endforeach;
}
}
}
// Add action
add_action('wpseo_register_extra_replacements', 'ss_register_custom_yoast_variables');
thanks John. I code for Yoast apparently has changed since then.
This plugin was recommended by ACF support.
https://wordpress.org/support/plugin/acf-content-analysis-for-yoast-seo
I don’t see anything changing after adding that plugin.
the shortcode formats I tried are:
%%cf_VariableName%% and
also regular custom options code from ACF –> [acf field="VariableName" post_id="options"]
Any idea on what needs to be done after plugin installation? I am a bit surprised that this isn’t a bigger issue for people using ACF.
am I missing something?
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.