How to get related tags based on a category?

You can get such tags using plain SQL query: global $wpdb; $wpdb->get_results( $wpdb->prepare( “SELECT tags.*, COUNT(tags_rel.object_id) as posts_count FROM {$wpdb->prefix}terms tags INNER JOIN {$wpdb->prefix}term_taxonomy tags_tax ON (tags_tax.term_id = tags.term_id) INNER JOIN {$wpdb->prefix}term_relationships tags_rel ON (tags_tax.term_taxonomy_id = tags_rel.term_taxonomy_id) INNER JOIN {$wpdb->prefix}posts posts ON (tags_rel.object_id = posts.ID) INNER JOIN {$wpdb->prefix}term_relationships cats_rel ON (posts.ID = cats_rel.object_id) INNER JOIN … Read more

Post in multiple categories

As long as there isn’t any technical issue on your site, such as plugin incompatibility or another glitch, the most common reason for your changes not appearing on the site is cache. You may have cache on the site, the server, a CDN or intermediate cache. Try to hard-refresh or disable cache plugins temporarily. If … Read more

How do I output all category with custom field?

Based on the code in your question, I can only see one problem. under “Show all category links”, you’ve got an “endwhile”, but no “while”, and an “endif”, but no “if”. Delete both the “endwhile” and “endif” and the code runs fine. The “Projects page code” works fine. I can’t reproduce your specific custom fields … Read more

Get category url in loop

Notice: Trying to get property of non-object That’s because $cat_parents is not an object; it’s an array: $cat_parents_url = get_category_link($cat_parents->term_id); Secondly, to get just the category URL, call get_category_parents() with the second parameter set to false, like so: $get_cat_parents = rtrim(get_category_parents($last_category->term_id, false, ‘,’),’,’); $get_cat_parents would then be a list/string of category slugs and not category … Read more