as a plus to my question here: Multiple Permalinks for custom post type post

I have an additional question. I make a new question because the old one is answered correctly.

My Code is the following:

function add_my_rule() {
        'index.php?p=$matches[1]', 'top'
add_action('init', 'add_my_rule');

This code is placed in my index file in my plugin.

The thing is now: We have an meta_key called test_id. So I want to make a link like https://www.example.com/test-subject/1. In this link 1 is not the post id it is the test_id from the meta_key of a post. So I want to redirect to the post, which have the right meta_key test_id. Some suggestions?



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.