B
B
buk962020-05-02 11:47:07
Search Engine Optimization
buk96, 2020-05-02 11:47:07

How to put "/" at the end of WORDPRESS CNC for headings?

Tell me how to make for categories (headings) a URL with "/" at the end, while leaving the entries without "/"?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nastya, 2020-05-02
@buk96

Try adding in to functions.php file

function pcl_smart_trailingslashit($string) {
  /* ensure, that there is one trailing slash */
  $string = rtrim($string, '/') . '/';
  /* if there is a filename extension like .html or .php, then remove the trailing slash */
  if ( 0 < preg_match("#\.[^/]+/$#", $string) ) {
    $string = rtrim($string, '/');
  }
  return $string;
}
add_filter('user_trailingslashit', 'pcl_smart_trailingslashit');

and in the CNC settings, set "Arbitrary", add /% postname%

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question