Categories doesnt work or work in wrong way

Hello, i have an issue with post categories, in my frontity.state.source i have wrong urls

there is routes to my blog category (not a custom post) categories are on routes without /blog/
for example -
not /blog/category/generowanie-leadow/
but /category/generowanie-leadow/

okey thats urls without /blog/ but works, unlike custom posts categories doesnt work at all (tried all urls what i can imagine)

for blog i need link /blog/category/category_name
for casestudies i need link /casestudies_category/category_name

There is link to my WP REST API https://wp.callpage.pl
There is link to my project git clone Bitbucket

my frontity.settings.js

const settings = {
  "name": "call-page",
  "state": {
    "frontity": {
      "url": "https://wp.callpage.pl",
      "title": "CallPage | Widget kontaktowy - CallPage®",
      "description": "Some text here",
    }
  },
  "packages": [
    {
      "name": "call-page",
    },
    {
      "name": "@frontity/wp-source",
      "state": {
        "source": {
          "url": "https://wp.callpage.pl",
          "postsPage": "/blog",
          "postTypes": [
            {
              type: "posts",
              endpoint: "posts",
              archive: "/blog"
            },
            {
              type: "wiedza",
              endpoint: "wiedza",
              archive: "/wiedza",
            },
            {
              type: "casestudies",
              endpoint: "casestudies",
              archive: "/casestudies"
            },
            {
              type: "branze",
              endpoint: "branze",
              archive: "/branze"
            }
          ]
        }
      },
    },
    {
      name: "@frontity/google-tag-manager-analytics",
      state: {
        googleTagManagerAnalytics: {
          containerIds: ["GTM-PPFXRVZ"],
        },
      },
    },
    "@frontity/tiny-router",
    "@frontity/html2react"
  ]
};

export default settings;

and there is my wp functions.php

<?php
​
​
​
​
​
register_nav_menus( array(
    'primary' => __( 'Primary Menu', 'callpage' ),
) );
​
​
​
​
/*
* Enable support for custom logo.
*
*/
	// add_theme_support( 'custom-logo', array(
	// 	'height'      => 400,
	// 	'width'       => 100,
	// 	'flex-height' => true,
	// 	'flex-width'  => true,
	// ) );
​
​
​
    add_filter('wpcf7_autop_or_not', '__return_false');
​
​
​
​
​
// Register thumbnails
	// add_theme_support( 'post-thumbnails' );
	// add_image_size( 'homepage-thumb', 385, 302 ); 
​
​
​
​
​
// This adds support for pages only:
	// add_theme_support( 'post-thumbnails', array( 'page' ) );
​
//add option page to panel (ACF)
// if( function_exists('acf_add_options_page') ) {
// 	acf_add_options_page();
​
// }
​
	//add option page to panel (ACF)
	if( function_exists('acf_add_options_page') ) {
		acf_add_options_page('Blog widget');
		// acf_add_options_page('Header');
		// acf_add_options_page('Footer');
	}
​
​
	
	
	
	
	
	
	
	
	
	
	
	
	
	
// // wiedza
// // Dodawanie nowego typu postów START
function create_wiedza_posttype(){
	$args = array(
	'label' => 'Wiedza',
	'labels' => array(
	'name' => __('Wiedza'),
	'singular_name' => __('Wiedza'),
	'add_new' => __('Dodaj wiedzę'),
	'add_new_item' => __('Dodaj Nową wiedzę'),
	'edit_item' => __('Edytuj wiedzę'),
	'new_item' => __('Nowy wiedzę'),
	'view_item' => __('Zobacz wiedzę'),
	'search_items' => __('Szukaj wiedzy'),
	'not_found' => __('Nie Znaleziono wiedzy'),
	'not_found_in_trash' => __('Brak wiedzy w koszu'),
	'all_items' => __('Cała wiedza'),
	'archives' => __('Zarchiwizowana wiedza'),
	'insert_into_item' => __('Dodaj do wiedzy'),
	'uploaded_to_this_item' => __('Sciągnięto do bieżącej wiedzy'),
	'featured_image' => __('Zdjęcie wiedzy'),
	'set_featured_image' => __('Ustaw Zdjęcie wiedzy'),
	'remove_featured_image' => __('Usuń Zdjęcie wiedzy'),
	'use_featured_image' => __('Użyj Zdjęcie wiedzy'),
	'menu_name' => __('Wiedza')
	),
	'description' => __('Typ Postu zawiera treść dla wiedzy'),
	'public' => true,
	'exclude_from_search' => false,
	'publicly_queryable' => true,
	'show_ui' => true,
	'show_in_nav_menus' => true,
	'show_in_menu' => true,
	'show_in_admin_bar' => true,
	'menu_position' => 5,
	'menu_icon' => 'dashicons-coffee',
	'supports' => array('title','editor','author','thumbnail','excerpt','revisions','page-attributes'),
	'has_archive' => false,
	'hierarchical' => false,
	'show_in_rest' => true,
	'rewrite' => array('slug'=>'wiedza','with_front'=>false),
	'capabilities' => array(
	'edit_post' => 'update_core',
	'read_post' => 'update_core',
	'delete_post' => 'update_core',
	'edit_posts' => 'update_core',
	'edit_others_posts' => 'update_core',
	'delete_posts' => 'update_core',
	'publish_posts' => 'update_core',
	'read_private_posts' => 'update_core'
	),
	);
	register_post_type('wiedza',$args);
	}
	add_action('init','create_wiedza_posttype',0);
	
	function register_taxonomy_category_wiedza() {
	$labels = [
	'name' => _x('Categories', 'taxonomy general name'),
	'singular_name' => _x('Category', 'taxonomy singular name'),
	'search_items' => __('Search Categories'),
	'all_items' => __('All Categories'),
	'parent_item' => __('Parent Category'),
	'parent_item_colon' => __('Parent Category:'),
	'edit_item' => __('Edit Category'),
	'update_item' => __('Update Category'),
	'add_new_item' => __('Add New Category'),
	'new_item_name' => __('New Category Name'),
	'menu_name' => __('Kategorie'),
	];
	$args = [
	'hierarchical' => true, // make it hierarchical (like categories)
	'labels' => $labels,
	'show_ui' => true,
	'show_in_rest' => true,
	'show_admin_column' => true,
	'query_var' => true,
	'rewrite' => ['slug' => 'category_wiedza'],
	];
	register_taxonomy('category_wiedza', ['wiedza'], $args);
	}
	add_action('init', 'register_taxonomy_category_wiedza');	
	
​
	function my_plugin_rest_route_for_post( $route, $post ) {
		if ( $post->post_type === 'wiedza' ) {
			$route = '/wp/v2/wiedza/' . $post->ID;
		}
​
		if ( $post->post_type === 'branze' ) {
			$route = '/wp/v2/branze/' . $post->ID;
		}
	 
		return $route;
	}
	add_filter( 'rest_route_for_post', 'my_plugin_rest_route_for_post', 10, 2 );
​
​
​
​
​
// // case studies
// // Dodawanie nowego typu postów START
function create_casestudies_posttype(){
	$args = array(
	'label' => 'casestudies',
	'labels' => array(
	'name' => __('casestudies'),
	'singular_name' => __('casestudies'),
	'add_new' => __('Add case studies'),
	'add_new_item' => __('Add new case studies'),
	'edit_item' => __('Edit cases tudies'),
	'new_item' => __('New case studies'),
	'view_item' => __('See case studies'),
	'search_items' => __('Search case studies'),
	'not_found' => __('Not found case studies'),
	'not_found_in_trash' => __('Missing case studies in trash'),
	'all_items' => __('All case studies'),
	'archives' => __('Zarchiwizowane ebooki'),
	'insert_into_item' => __('Add to case studies'),
	'uploaded_to_this_item' => __('Sciągnięto do bieżącego ebooka'),
	'featured_image' => __('Thumbnail case studies'),
	'set_featured_image' => __('Set thumbnail case studies'),
	'remove_featured_image' => __('Delete thumbnail case studies'),
	'use_featured_image' => __('Use thumbnail case studies'),
	'menu_name' => __('casestudies')
	),
	'description' => __('Typ Postu zawiera treść dla case studies'),
	'public' => true,
	'exclude_from_search' => false,
	'publicly_queryable' => true,
	'show_ui' => true,
	'show_in_nav_menus' => true,
	'show_in_menu' => true,
	'show_in_admin_bar' => true,
	'menu_position' => 5,
	'menu_icon' => 'dashicons-coffee',
	'supports' => array('title','editor','author','thumbnail','excerpt','revisions','page-attributes'),
	'has_archive' => false,
	'hierarchical' => false,
	'show_in_rest' => true,
	'rewrite' => array('slug'=>'casestudies','with_front'=>false),
	'capabilities' => array(
	'edit_post' => 'update_core',
	'read_post' => 'update_core',
	'delete_post' => 'update_core',
	'edit_posts' => 'update_core',
	'edit_others_posts' => 'update_core',
	'delete_posts' => 'update_core',
	'publish_posts' => 'update_core',
	'read_private_posts' => 'update_core'
	),
	);
	register_post_type('casestudies',$args);
	}
	add_action('init','create_casestudies_posttype',0);
	
	function register_taxonomy_category_casestudies() {
	$labels = [
	'name' => _x('Categories', 'taxonomy general name'),
	'singular_name' => _x('Category', 'taxonomy singular name'),
	'search_items' => __('Search Categories'),
	'all_items' => __('All Categories'),
	'parent_item' => __('Parent Category'),
	'parent_item_colon' => __('Parent Category:'),
	'edit_item' => __('Edit Category'),
	'update_item' => __('Update Category'),
	'add_new_item' => __('Add New Category'),
	'new_item_name' => __('New Category Name'),
	'menu_name' => __('Category'),
	];
	$args = [
	'hierarchical' => true, // make it hierarchical (like categories)
	'labels' => $labels,
	'show_ui' => true,
	'show_in_rest' => true,
	'show_admin_column' => true,
	'query_var' => true,
	'rewrite' => ['slug' => 'category_casestudies'],
	];
	register_taxonomy('category_casestudies', ['casestudies'], $args);
	}
	add_action('init', 'register_taxonomy_category_casestudies');	
	
​
	// function my_plugin_rest_route_for_post( $route, $post ) {
	// 	if ( $post->post_type === 'casestudies' ) {
	// 		$route = '/wp/v2/casestudies/' . $post->ID;
	// 	}
	 
	// 	return $route;
	// }
	// add_filter( 'rest_route_for_post', 'my_plugin_rest_route_for_post', 10, 2 );
​
​
​
​
​
​
​
	// add taxonomy medicine
	function register_taxonomy_medicine_casestudies() {
		$labels = [
		'name' => _x('Medicine', 'taxonomy general name'),
		'singular_name' => _x('medicine', 'taxonomy singular name'),
		'search_items' => __('Search medicine'),
		'all_items' => __('All medicines'),
		'parent_item' => __('Parent medicine'),
		'parent_item_colon' => __('Parent medicine:'),
		'edit_item' => __('Edit medicine'),
		'update_item' => __('Update medicine'),
		'add_new_item' => __('Add New medicine'),
		'new_item_name' => __('New medicine Name'),
		'menu_name' => __('medicine'),
		];
		$args = [
		'hierarchical' => true, // make it hierarchical (like categories)
		'labels' => $labels,
		'show_ui' => true,
		'show_in_rest' => true,
		'show_admin_column' => true,
		'query_var' => true,
		'rewrite' => ['slug' => 'medicine_casestudies'],
		];
		register_taxonomy('medicine_casestudies', ['casestudies'], $args);
		}
		add_action('init', 'register_taxonomy_medicine_casestudies');	
	// end taxonomy medicine	
​
​
// ______________________________________________ concreate industry custom post _________________________________________
​
​
// // Dodawanie nowego typu postów START
function create_branze_posttype(){
	$args = array(
	'label' => 'Branże',
	'labels' => array(
	'name' => __('Branże'),
	'singular_name' => __('Branże'),
	'add_new' => __('Dodaj Branże'),
	'add_new_item' => __('Dodaj Nową Branżę'),
	'edit_item' => __('Edytuj Branżę'),
	'new_item' => __('Nowa Branża'),
	'view_item' => __('Zobacz Branżę'),
	'search_items' => __('Szukaj Branży'),
	'not_found' => __('Nie Znaleziono Branży'),
	'not_found_in_trash' => __('Brak Branży w koszu'),
	'all_items' => __('Wszystkie Branże'),
	'archives' => __('Zarchiwizowane Branże'),
	'insert_into_item' => __('Dodaj do Branży'),
	'uploaded_to_this_item' => __('Sciągnięto do bieżącegj Branży'),
	'featured_image' => __('Zdjęcie Branży'),
	'set_featured_image' => __('Ustaw Zdjęcie Branży'),
	'remove_featured_image' => __('Usuń Zdjęcie Branży'),
	'use_featured_image' => __('Użyj Zdjęcie Branży'),
	'menu_name' => __('Branże')
	),
	'description' => __('Typ Postu zawiera treść dla Branży'),
	'public' => true,
	'exclude_from_search' => false,
	'publicly_queryable' => true,
	'show_ui' => true,
	'show_in_nav_menus' => true,
	'show_in_menu' => true,
	'show_in_admin_bar' => true,
	'menu_position' => 5,
	'menu_icon' => 'dashicons-coffee',
	'supports' => array('title','editor','author','thumbnail','excerpt','revisions','page-attributes'),
	'has_archive' => false,
	'hierarchical' => false,
	'show_in_rest' => true,
	'rewrite' => array('slug'=>'branze','with_front'=>false),
	'capabilities' => array(
	'edit_post' => 'update_core',
	'read_post' => 'update_core',
	'delete_post' => 'update_core',
	'edit_posts' => 'update_core',
	'edit_others_posts' => 'update_core',
	'delete_posts' => 'update_core',
	'publish_posts' => 'update_core',
	'read_private_posts' => 'update_core'
	),
	);
	register_post_type('branze',$args);
	}
	add_action('init','create_branze_posttype',0);
	
	function register_taxonomy_category_branze() {
	$labels = [
	'name' => _x('Categories', 'taxonomy general name'),
	'singular_name' => _x('Category', 'taxonomy singular name'),
	'search_items' => __('Search Categories'),
	'all_items' => __('All Categories'),
	'parent_item' => __('Parent Category'),
	'parent_item_colon' => __('Parent Category:'),
	'edit_item' => __('Edit Category'),
	'update_item' => __('Update Category'),
	'add_new_item' => __('Add New Category'),
	'new_item_name' => __('New Category Name'),
	'menu_name' => __('Kategorie'),
	];
	$args = [
	'hierarchical' => true, 
	'labels' => $labels,
	'show_ui' => true,
	'show_in_rest' => true,
	'show_admin_column' => true,
	'query_var' => true,
	'rewrite' => ['slug' => 'category_branze'],
	];
	register_taxonomy('category_branze', ['branze'], $args);
	}
	add_action('init', 'register_taxonomy_category_branze');	
	
​
​
​
	// function my_plugin_rest_route_for_post( $route, $post ) {
	// 	if ( $post->post_type === 'branze' ) {
	// 		$route = '/wp/v2/branze/' . $post->ID;
	// 	}
	 
	// 	return $route;
	// }
	// add_filter( 'rest_route_for_post', 'my_plugin_rest_route_for_post', 10, 2 );
​
​
​
​
​
	add_filter( 'rest_post_collection_params', function ( $params, WP_Post_Type $post_type ) {
		if ( 'post' === $post_type->name && isset( $params['per_page'] ) ) {
			$params['per_page']['maximum'] = 1000;
		}
	
		return $params;
	}, 10, 2 );
​
​
​
​
​
​
	function wl_page_by_slug( $slug ) {
​
		echo "<pre>";
		print_r($slug['slug']);
		echo "</pre>";
	  
		//remember if here should always return in json
		return array( $slug['slug'] );
	  }
	  
	  add_action('rest_api_init', function() {
		register_rest_route('wl/v1', 'post/(?P<slug>[a-zA-Z0-9-]+)', [
		  'methods' => 'GET',
		  'callback' => 'wl_page_by_slug',
		]);
	  });
​
	?>

By default does WP use /blog/category-name and /blog/category-name/post-name, so that is correct.

However you’re doing something non-standard by removing the /blog/ part from the url for archive pages, but still expecting the /blog/ url to be the postsPage and the archive page (in frontity.settings.js). This means the category pages will have the same root at /blog/.

How did you remove the /blog/ part in WP for categories, because I can’t find that in your functions.php?

In default posts urls was localhost:3000/categories/category_name
i implement posts as custom post in frontity.settings.js
{
type: “posts”,
endpoint: “posts”,
archive: “/blog”
},
i know that blog urls works ok, but my problem that i cant casestudies categories url

The REST API has an endpoint for them https://wp.callpage.pl/wp-json/wp/v2/category_casestudies.

And looking at the documentation (see: @frontity/wp-source - API Reference) you’ll need to modify your settings to fit the correct structure:

{
      "name": "@frontity/wp-source",
      "state": {
        "source": {
          "url": "https://wp.callpage.pl",
          "postsPage": "/blog",
          "postTypes": [
            {
              type: "posts",
              endpoint: "posts",
              archive: "/blog"
            },
            {
              type: "casestudies",  // post_type
              endpoint: "category_casestudies",  // category slug
              archive: "/casestudies", // category archive page
            },
// ...

you dont understand me, i have custom post casestudies, which have categories medicine and test, how i can get all casestudies with category medicine?

i tried somithing like this

localhost:3000/medicine/
localhost:3000/casestudies/medicine/
localhost:3000/casestudies/category/medicine/
localhost:3000/casestudies/casestudies_category/medicine/
localhost:3000/casestudies_category/medicine/
localhost:3000/casestudies_category/category/medicine/
localhost:3000/category/medicine/

and all of that urls give me 404

Have you checked @frontity/wp-source - API Reference? Because it’s normal for Frontity to not understand taxonomies very well (especially because WP also has issues with it).