aioseo_description hook not being called but aioseo_title or aioseo_keywords is
-
Hi there,
I’m running a WP multisite (v6.3.2) with the latest AIOSEO version (4.5) however on a custom post type single, aioseo_description isn’t being called but aioseo_title and aioseo_keywords are. The meta hooks pull in some data from another childsite (hence the switch_to_blog() being called). All the 3 hooks happen one after the other (in functions.php) in the order of aioseo_title, aioseo_description, aioseo_keywords. I’ve tried commenting out the other hooks, but no avail.
Snippet of code for aioseo_description I’m using
add_filter('aioseo_description', function ($description) { if (is_singular('venues')) { switch_to_blog(get_multisite_id('smart_venues')); $seo_description = get_post_meta(get_the_ID(), '_aioseo_description', true); restore_current_blog(); return !empty($seo_description) ? $seo_description : $description; } return $description; });
aioseo_title and aioseo_keywords code snippets are exactly the same, they just look at a different get_post_meta field.
This code works fine elsewhere on other pages, (ie. a normal page etc), its just not being called when on a custom post type. Any thoughts?
- The topic ‘aioseo_description hook not being called but aioseo_title or aioseo_keywords is’ is closed to new replies.