Permalinks problem – Category pages don’t work

enter image description here

I tried many different solutions to get category page for wordpress to work.
Here are my settings in wordpress.

I like to have structure “domainname.com/name of the post/” but when I want to go to individual category page I receive an error that it doesn’t exist.

If I change permalink structure from /%postname%/ to /%postname%/%category%/
everything works fine but the structure of the post is domainname.com/category/name of the post/ and I don’t want that. mydomain.com/health/ doesn’t work if I keep the name of the post only. It works when I change it to /%postname%/%category%/

I tried to remove . in base category and it doesn’t make any difference.

These are my entries in function.php

    <?php
function comment_reply_text( $link ) {
$link = str_replace( 'Reply', 'Odgovori', $link );
return $link;
}
add_filter( 'comment_reply_link', 'comment_reply_text' );
?>
<?php
function catch_that_image() {
  global $post, $posts;
  $first_img = '';
  ob_start();
  ob_end_clean();
  $output = preg_match_all('/<img.+src=['"]([^'"]+)['"].*>/i', $post->post_content, $matches);
  $first_img = $matches [1] [0];

  if(empty($first_img)){ //Defines a default image
    $first_img = "/images/default.jpg";
  }
  return $first_img;
}
?>
<?php
function wpsites_query( $query ) {
if ( $query->is_home() && $query->is_main_query() ) { 
$query->set( 'posts_per_page', 10 ); }
}
add_action( 'pre_get_posts', 'wpsites_query' );
?>
<?php
function custom_excerpt($word_count_limit) {
    $content = wp_strip_all_tags(get_the_content() , true );
    echo wp_trim_words($content, $word_count_limit);
}
?>
<?php
add_filter( 'term_link', function($termlink){ return str_replace('/./', '.', $termlink); }, 10, 1 );
?>

Any ideas?

Read more here:: Permalinks problem – Category pages don’t work

Leave a Reply

Your email address will not be published. Required fields are marked *