Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Primacy

    (@primacy)

    Hi Hiroshi,

    Thank you so much for taking the time to help us.

    We have tried the code above in many ways, with no luck. We are not very good with WordPress custom taxonomies.

    This is the last one we have tried in functions.php (child theme), knowing our coding is absolutely wrong in every way.

    //add rewrite to custom permalinks
    function custom_rewrite_tag() {
            add_rewrite_tag('%ct_question_category_id%', '([0-9]+)');
            add_rewrite_tag('%ct_qa_tag_id%', '([0-9]+)');
            add_rewrite_tag('%user_id%', '([0-9]+)');
    
    add_action('init', 'custom_rewrite_tag', 10 );
    
    function custom_rewrite_tag() {
    
        global $wp_rewrite;
        $wp_rewrite->add_permastruct('location', 'location/%ct_question_category_id%/%postname%', true, 1);
    
        add_rewrite_rule('location/([0-9]{4})/(.+)/?$', 'index.php?location=$matches[2]', 'top');
    
        $wp_rewrite->add_permastruct('topic', 'topic/%qa_tag_id%/%postname%', true, 1);
    
        add_rewrite_rule('topic/([0-9]{4})/(.+)/?$', 'index.php?topic=$matches[2]', 'top');
    
        $wp_rewrite->add_permastruct('profile', 'profile/%user_id%/%user%', true, 1);
    
        add_rewrite_rule('profile/([0-9]{4})/(.+)/?$', 'index.php?profile=$matches[2]', 'top');
        $wp_rewrite->flush_rules(); // !!!
    }

    We are waiting the theme moderators to give us the exact taxonomies used in the theme.

    Can you please help us in details? We know we are asking for too much but maybe step by step instructions will help us accomplish this.

    Kind regards,
    Oscar Oz

    Thread Starter Primacy

    (@primacy)

    Hi Hiroshi,

    We have made the changes for questions, polls and answers for both which works great with the permalink structure and some coding into child themes functions.

    Working permalink structure:
    domain/question/%post_id%/%postname%
    Working permalink structure: domain/answer/%post_id%/%postname%
    Working permalink structure: domain/poll/%post_id%/%postname%
    Working permalink structure: domain/poll-answer/%post_id%/%postname%

    We just can’t find a way to create below permalink structures:

    Wanted permalink structure: domain/question_category/%category_id%/%postname%
    Wanted permalink structure: domain/qa_tag/%tag_id%/%postname%
    Wanted permalink structure: domain/member/%author_id%/%postname%

    We have searched for a solution for over a month now, but your plugin came closest to a solution, but it does not pick up the custom types above.

    Can you please help us out, so we can go live with the website?

    Kind regards,
    Oscar Oz

Viewing 2 replies - 1 through 2 (of 2 total)