Do the categories all have posts, change line 2 to:
$categories = wp_list_categories('hide_empty=0&title_li=0&child_of=".$categoryslug->term_id");
This sets it to display all categories even if empty
If that doesn’t work then you need to echo each part and find the cause of the “error” so echo each element e.g.
echo $categoryslug;
if that works then change to
echo $categoryslug->term_id;
If that works then print the array of categories e.g.
print_r($categories);
Echoing each element individually will lead you to the culprit and then you can find the root cause
Related Posts:
- What does the token %1$s in WordPress represent [closed]
- exclude multiple terms using get_terms() function
- retrieve thumbnail from post ID of best selling product in category
- Custom HTML structure in wp_list_categories
- Display all posts in current category
- How to Populate the list of custom post type categories
- Php string not working in WordPress Functions.php [duplicate]
- How to display related posts from parent category
- User Defined order on get_categories?
- How can I set custom order use this function
- Categories Template Assistance
- Error: array_map(): Argument #2
- Problems with function on function.php
- Use template for posts with a particular category grandparent
- Check if Product is in a Specific Category in Functions.php
- Display all categories including sub categories
- Custom category code not showing all posts
- Category Thumbnail Display – How to display ONLY the main Category
- How to use transient in this code for related post?
- Swapping wp_dropdown_categories function with wp_category_checklist
- What is an equivalent of single_cat_title for getting the slug of the category?
- Pass Category Name, Description and Photo into variables to pass to jQuery
- Move category description below post list in blog
- Applying A Category to Existing Posts Where Page Title Matches Regex
- Setting default category base on theme activation
- Recent Posts Not Showing Only On A Specific Category Page [closed]
- Let Users Choose Post Categories
- Display category name only once inside loop
- Dilemma of Populating all the categories in a drop down list
- Define specific category name in PHP
- JSON REST API WordPress only showing first 10 categories
- Category title output before opening title tag
- Include Parent Term in wp_list_categories
- I’m trying to create an array with a foreach loop, but the array only stores the last item [closed]
- Get all categories post is not in
- Rewrite with pagination /foo/page/2/ to posts of a given category, page 2
- In WordPress, how do I get the number of posts next to single_cat_title(”); in the category.php file?
- How to get category name or ID by post?
- How to hide posts of a specific custom category in WordPress?
- Post not populating for custom post type based on category selection
- Add new post in existing categories using wp_insert_post
- How to change logo by category
- Problem with custom loop and wp_list_pluck [closed]
- Listing titles and custom fields of entries within subcategories
- random display categories – change url
- Output category list inside array
- Do not duplicate posts with multiple categories in multiple loops
- Removing sidebar on category pages
- go to home page when i select default in select-box
- Finding and removing duplicates within WP Arrays
- Adding wp_list_categories to a specific div that was appended using jQuery
- Remove Custom Post Category In WordPress Slug Using .Htaccess
- Counting number of posts in multiple (sub)categories using shortcode
- Wrong Number of Products When Hiding Subcategory Products From Showing In Parent Category
- How do I edit the terms output args or array data?
- Change category thumbnail size
- Get main parent category for post (WordPress/Advanced Custom Fields)
- Display Visual Composer shortcode if a post belongs in specific categories
- admin panel – How to remove “delete” button from category editing page
- Category Page Displaying all Pages
- Get parent category name when only child category is applied to a product
- Multiple Tag Filtering
- Link to index.php from home.php?
- How does Permalink work with the AMP plugin after Removing Parent Permalink Catalog from Posts
- Polylang and template files
- Notice: Undefined variable
- Hide a specific category title from displaying on site
- Show subcategory name selected in specific category woocoommerce
- Return to the beginning of the results of a for loop
- Exclude category and post from loop in custom category.php
- Admin backend, show post from a category and exclude the posts from subcategories
- Populate Posts based on category selected using AJAX that means without page refresh
- random woocommerce categories are not showing when count enabled?
- Exclude a category slug on pagination
- Custom content using in_category
- How to Retrieve All Category Images on Front-End
- PHP drop down menu for my get_category child of
- Short code into PHP
- Need Quick Help With Product Category Page
- Need to adjust condition to say if I’m pulling categories from a post, to pull only the first one
- Rearrange get_categories array compared to another array
- Search in particular category in wordpress
- Query seems to be duplicated
- Top menu disapears in Category Pages when filtering using ACF
- Is there a way to randomize and connect a background and header image?
- wp_get_archive for category returning different URLs on different but similar sites
- Error trying import one category on page
- dynamically filter by category via sub-menu
- Remove the_content From Loop
- Category List in Theme Options Page
- Get unique post in parent category
- Code that displays images – images get shown multiple times
- Incomplete term slugs output from a foreach loop with get_the_terms
- Display post of specific category on page
- Displaying categories
- Product Category Page in Full Width
- Display all categories (with link) of custom post type – WordPress
- Display featured posts first, then display all others within a specific category in WordPress
- Can’t assign menu parent id or menu item breaks
- Prevent publishing of uncategorized posts