Articles of hooks

Is there a filter hook that I can use to change how taxonomy term names are displayed?

I need to hide a custom taxonomy‘s terms‘ names on the frontend while preserving them on the backend. Instead of the terms’ names I need to display pseudonyms. I can’t find a single filter hook to do that. I’ve tried the ones in sanitize_term_field but that only works when the context is ‘display’. It seems […]

Order of Operation for these three hooks

What is the order of firing for these three hooks? add_filter( ‘comments_array’, array( $this, ‘BuildCommentsArray’ ), 10, 2 ); add_action( ‘preprocess_comment’, array( $this, ‘write’ ), 10, 1 ); add_action( ‘comment_post’, array( $this, ‘add_meta’ ), 10, 1 ); This is what I’m trying to achieve, but I’m getting a loop. In BuildCommentsArray, posts from a forum […]

What hooks/filters are there to alter selected terms on post save?

Very simple, where would I hook/filter to alter the users selection of terms when they save a post (Update or Add)? I need to hook in all instances; such as when saving a post via AJAX, saving when JavaScript is disabled and a normal POST is done and when posts are saved via quick edit.

Strict tag list – user should choose only existing tags for posts

While selecting tags for the posts the user is able to create new tags on fly. For example we have the tag ‘animal’ but the user misstpye it as ‘aminal’ – and WordPress creates it. In our blog the strict tag structure is essential. How can I disable this function? Edit Solution added.

How to get post ID in post_updated action hook?

I want to execute a function, myfunction() [hypothetically named], whenever a page is updated in the admin. The function doesn’t do anything to the content that is saved—it just runs an unrelated task elsewhere. I read that the post_updated hook is good to use for this, but I cannot seem to get this code to […]

When calling wp_title(), do you have to create some kind of “title.php” file?

… or does wp_title() already handle the various contexts in your blog? This could clarify for me how I can achieve a reusable index.php file without having all the conditional statements inside it to handle the different title formats in the given context (page, single, posts, search, archive, date, etc…) Also, Could a specific post […]

Showing Notifications While Activating Plugin

I want to give errors like this, while activating my plugin. Which hooks should i use ? Can you share simple examples ? In shortly,when user activate my plugin, is a directory’s CHMOD isn’t 777 , i’ll warn it and stop activation.

How to debug removal of rewrite rule flushing?

I use Custom Post Types. I try this: functions.php add_action( ‘admin_init’, ‘flush_rewrite_rules’ ); Now I’d like to remove this again. I try this: remove_action( ‘admin_init’, ‘flush_rewrite_rules’ ); I’m not sure if it works right. How can I test if the rewrite rules really not flushed anymore?

How can I hide all posts that don't have a thumbnail?

I want to prevent posts that dont have thumbnails from showing on the homepage, category page, archive, etc. Using something like if (get_the_post_thumbnail_url() != “”) { //don’t insert post } What filter / hook should I use?

hooks & filters and variables

I was updating the codex page example for action hooks, while playing around to get some reuseable functions done (originally for some Q over here @WA). But then i ran into a problem i wasn’t aware of before: After hooking into a function to modify the output of a variable, i can’t anymore decide if […]