Skip to content

4. Actions

Héctor Cabrera edited this page May 25, 2022 · 6 revisions

Actions are hooks that are fired after specific events take place in WordPress, such as publishing a new post, registering a new user, etc. Basically, actions let you do stuff when something has happened.

You can take advantage of this to do stuff when certain actions happens within WordPress Popular Posts. To hook into these actions, put your custom functions in your theme's functions.php file (or you can also create a plugin for this purpose, if you know how to).

Available action hooks:

wpp_pre_update_views

Since: 3.2.2.

This hook runs before updating the views count of a post / page.

Arguments: INT post ID, INT views count.

wpp_post_update_views

Since: 3.0.0.

This hook runs after updating the views count of a post / page.

Arguments: INT post ID.

Clone this wiki locally