add_action() in switch statement

Not quite sure what you’re after – something like this? <?php echo apply_filters( ‘basey_page_title_news’, __( ‘<h1>News</h1>’, ‘basey’ ) ) ?> <?php while ( have_posts() ) : the_post(); switch ( true ) : case has_action( “basey_loop_single_$post->post_type” ) : do_action( “basey_loop_single_$post->post_type”, $post ); break; default : ?> <!– your fallback code –> <?php endswitch; endwhile; ?> If … Read more

Action hook for editing post

Not a real answer. Take a look the files that use save_post and edit_post It will lead you to the hook post_updated Take a look and see if you can find a hook you need. Keep in mind that you might need to do some checks in the hook. You’ll figure it out.

publish_post action hook not working

If you did this instead… function the_fat_lady_sings() { wp_die(“this plugin is a far harder than i imageined”); } add_action(‘publish_post’,’the_fat_lady_sings’) I think you will see that it does work. The problem you are having with the echo is because WordPress processes the submission and then redirects back to form. You’ll never see the echoed string. That … Read more

admin_notices on runtime in function

I saw this on stackoverflow, may be able to modify it to work in your situation: function my_function($post_id){ if($error){ set_transient( get_current_user_id().’publisherror’, “Error Message” ); } return $post_id; } add_filter ( ‘publish_post’, ‘my_function’ ); function show_admin_notice() { if($out = get_transient( get_current_user_id().’publisherror’ ) ) { delete_transient( get_current_user_id().’publisherror’ ); echo ‘<div class=”error”><p>’.$out.'</p></div>’; } } add_action(‘admin_notices’, “show_admin_notice”);

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)