Articles of filters

When to use actions and when to use filters

I’m trying to understand where to use filters and where to use actions. Suppose I have a query in a plugin, which later add on modules might modify to change the results of the query, thus modifying the arguments. Would this be an ideal implementation of this concept, or should I be using actions here? […]

Make parent categories not selectable

I’d like that my categories having child-categories don’t be selectable on the post article page. What I want to do is to remove the checkbox before their label. I’ve looked the filter documentation but I wasn’t able to find any filter that suits my need.

Customizing WordPress the_title with add_filter

I’m trying to create a custom wordpress title for a posts made under a custom post. Basically, its a version changelog for an application. I would like to only input the version number in the title field, and the output has to be standardized with a string accordingly. My custom post type is ‘custom_version’ and […]

wp_title() empty on a static front page

I’m trying to use wp_title() to create a heading for my pages, but I’m using a static front page and, while all of the other pages render the title properly, the front page won’t. This is what I’m working with: <div id=”main-content”> <h1><?php wp_title(“”, true); ?></h1> <?php while( have_posts() ) : the_post() ?> <div class=”pagecontent”> […]

Display WooCommerce newest product reviews on top

By default, woocommerce product reviews are listed in chronological order. How do you get the newest review to appear first?

Add classname to the_category() function?

is it possible to use add_filter or something similar to add the slug of the category as classname to the the_category() function? Right now when using the_category() the output looks like this … <ul class=”post-categories”> <li> <a href=”http://mysite.com/something” title=”” rel=”category tag”>News</a> </li> </ul> Is it possible to somehow get this … <ul class=”post-categories”> <li class=”category-news”> […]

How to add custom content under plugin row in WordPress admin plugin list?

I’m looking to add a custom message under my plugin in the “Plugins” page, much like the following screenshot: What action or filter should I use? Thank you!

How to make <!–more–> a button?

There is plenty of information on how to make the Read More function display different text in the Codex but what kind of filter would need to be used to make it display <button class=”readmorebtn” onclick(permalink)>Read More</button>?

How to list the Hooks and order of execution in current loading page?

This question already has an answer here: How to get WordPress' hook run sequence? 3 answers

Using filter to add additional fields to comment_form()

I want to add a field to the comments and have used these codes. functions.php function my_fields($fields) { $fields[‘url2’] = ‘<p class=”comment-form-url2″> <label for=”url2″>URL hittad på webben</label> <input id=”url2″ name=”url2″ type=”text” value=”” size=”30″ /> </p>’; return $fields; } add_filter(‘comment_form_default_fields’,’my_fields’); comments.php comment_form(); Questions It does not add an extra field in admin comment. Should it, or […]