Retrieving category’s color with get_term_meta

From your question, it seems that you want to fetch the meta for the post. In which case you would want get_post_meta which would look something like this: echo get_post_meta( get_the_ID(), ‘color’, true ); Change the second value (‘color’) to whatever you have used for the meta key – I took a wild guess.

How can I use get_post_meta with add_rewrite_rule to build custom permalinks?

Not sure the rewrite rule is good, but to answer the question about getting the post meta – you already have the post Object, so you don’t need to run a function to get the global $post, which might also fail or be wrong – you can simply use: $metaText = get_post_meta( $post->ID, ‘test_text_field’, true); … Read more