I'm trying to create a glossary for my WordPress site, using a custom post type 'glossary'.
My idea is to create posts for each term/word I want to explain (for example: 'blepharoplasty'),
and use the content of the post to provide a description.
This works fine standalone with single post pages, and an archive to display all of them.
But I want to hook this into the rest of my site and automatically find any instances of my custom post titles in post meta data and the_content,
and if found, to provide a link to the single post page.
I know a filter/hook is needed, but I have no idea how to write the conditions.
I think 121679 is somewhere along the lines, but I just don't know how to reference my custom post type, and how to search against the current post I'm using.
Can anyone help?
function bv_glossary_content_links($null, $object_id, $meta_key, $single ) {
// What conditions can go here?
}
add_filter('get_post_metadata', 'bv_glossary_content_links', 10, 4);