How best to store data (URLs and IDs) extracted from posts and pages using custom taxonomies

I want to store metadata extracted from post/page content:

IDs of other posts/pages on the same blog linked within the content of each post/page
certain external URLs contained within the content of each post/page

I’ve created two custom taxonomies to store this information: internal_reference and external_reference. Both are non-hierarchical and non-public. Edit page meta-boxes are also switched off as the metadata is extracted programmatically, and I don’t want users overriding this with the checkboxes provided for other taxonomies like categories.

I’ve written a function that can extract the IDs and URLs from the post/page content, which runs on the save_post hook.

The problem I’m having is how best to store this information. Clearly I must use wp_set_post_terms to associated the terms with the post in question, but I can’t work out whether I need to use add_term_meta to set the IDs and URLs or if I can just use the term’s name or slug field.

How is this sort of thing intended to be done in WordPress? Forgive me if this is a rather basic question, but this feature of WordPress is new to me.

Read more here:: How best to store data (URLs and IDs) extracted from posts and pages using custom taxonomies

Leave a Reply

Your email address will not be published. Required fields are marked *