Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

MarkJ123 on "Newbie: add_action('save_post') Question"

$
0
0

Hi, I am trying to alter some content when a post is created.
In my plugin I am hooking into the WordPress event by calling

add_action('save_post','insert_method')

Where my insert_method is below

function insert_method( $post_id ) {

The issue I am having is that this appears to fire multiple times when a post is created and therefore the code inside the method fires as well.

I have tried to do the following

if ( !wp_is_post_revision( $post_id ) )

but unfortunately it still does not work.

This is my first plugin attempt so I am still learning but any help / advice about how to fix the problem would be appreciated :)

Regards
Mark


Viewing all articles
Browse latest Browse all 8245

Trending Articles