F
F
freshcot2015-10-12 18:17:03
PHP
freshcot, 2015-10-12 18:17:03

How to change link in wordpress?

Hello, there is a site on wp with the theme installed. The theme has the ability to create reviews, reviews are added to the main menu in the admin panel:
da758f1b724448f0a87243176fe8d3d7.jpg
If I click the View Testimonial button, the link in the address bar looks like this: domain.ru/testimonial/review-name
Question - how do I change "testimonial" to, for example , "reviews"?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
MetaDone, 2015-10-12
@MetaDone

look for the place in the functions.php file where register_post_type occurs

M
Mark Rosenthal, 2015-10-12
@font

You need to translate the template into Russian.
1) Find the localization file
2) Open it in poedit
3) Find and replace testimonial with reviews
4)???
5) Profit

M
Maxim Martirosov, 2015-10-12
@kalbac

function add_custom_rewrite_rule() {
    //Получаем структуру постоянных ссылок.
    if( ( $current_rules = get_option('rewrite_rules') ) ) {
        //Ищем нужный нам ярлык (slug)
        foreach($current_rules as $key => $val) {
            if(strpos($key, 'testimonial') !== false) {
                  //Если находим нужный нам 'testimonial' то перезаписываем его
                  add_rewrite_rule(str_ireplace('testimonial', 'отзывы', $key), $val, 'top');   
            }
        }
    }

    // Обновляем правила
    flush_rewrite_rules();
}
//Вешаем функцию на хук.
add_action('init', 'add_custom_rewrite_rule');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question