Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wordpress Hook: post loaded

I need to run a function for set some tags via post id when a post loaded. Is there any hook that lets me check post id when the post loaded ?

like image 892
Mosi Avatar asked Feb 10 '26 00:02

Mosi


1 Answers

Action hook you are looking for is the_post. This hook is fired after post object is created.

Quick example:

<?php
function some_post_action( $post_object ) {
    // your function here, use $post_object->ID to access post id
}
add_action( 'the_post', 'some_post_action' );
?>
like image 125
wojtek.ww Avatar answered Feb 12 '26 15:02

wojtek.ww



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!