Find out which user created a category or tag?
There’s no WordPress-specific way of doing this – unless you have Stream installed. If you don’t, you might want to think about installing it.
There’s no WordPress-specific way of doing this – unless you have Stream installed. If you don’t, you might want to think about installing it.
There is: the_category(), which not only seems to be all to fittingly named. Aside from that, don’t use query_posts, as for the why take a look at those two threads: When to use WP_query(), query_posts() and pre_get_posts When should you use WP_Query vs query_posts() vs get_posts()?
Yes you can pass the variable in category_name. But I think it should be get_the_title() instead of the_title(). $title = get_the_title(); $args = array( ‘category_name’ => $title ); Try this. But remember category_name only accepts category slug, not category name. You can also use following method if your page title/slug are different. And I think … Read more
Sorry, but I think I have searched for the wrong question. It seems like the answer to my question can be found in How to modify a taxonomy that’s already registered. Thanks to @helgatheviking !
‘category_name’ will not work. You are making use of a custom taxonomy, not build-in categories. It seems from this that you have a misunderstanding about taxonomies. Please take your time and see this post on this particular subject For custom taxonomies, use a tax_query to retrieve the posts that you need. Here is an example: … Read more
There is nothing directly meant for that (that I can think of), but there is very close in purpose function get_default_post_to_edit(). Since for the purpose of new post creation it makes post appear in DB before it is even saved for the first time (as auto draft) we can tinker with its filters a bit … Read more
I think it would be useful to create a custom walker for your menu. In the following code example I made use of the Menu Item Object. You can take a look at the object output here. An object type is specified for every menu item. So I just compare if the object is a … Read more
Well, what is the expected behavior? You use wp_set_object_terms and pass just a single term. If you want to make sure the specified term is assigned to the post, while being able to add as many other terms as you like, try it like this: function add_bookcategory_automatically( $post_id ) { if ( ! wp_is_post_revision( $post_id … Read more
I found what I needed: $category = get_category( get_query_var( ‘cat’ ) ); $cat_id = $category->cat_ID; $images = get_posts( array(‘post_type’ => ‘attachment’, ‘category__in’ => $cat_id)); if ( !empty($images) ) { foreach ( $images as $image ) { $image_url = $image->guid; } } else{ $image_url=””; } First I got the category, and current category ID I’m in. … Read more
WordPress determines which template file to use from its Template Hierarchy. It might be further customized by extensions and themes might be using different files for same things, depending on what they do. There are helper plugins for simpler cases (for example What The File), but it might require involved debug with more complex themes.