Use filter “og_image_init”: with CPT
-
Use filter “og_image_init”: for my CPT. I’ve tried the below but it’s not working. I’d just like to always use a default image for the event CPT. Is this possible?
/* Default image for Events FB sharing */ add_filter('og_image_init', 'my_og_image_init'); function my_og_image_init($images) { if ( is_singular('event')) { $images[] = 'https://mywebsite.co.uk/wp-content/uploads/2016/01/my-picture.jpg'; } return $images; }
Many thanks for any help.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Use filter “og_image_init”: with CPT’ is closed to new replies.