Tag Info

New answers tagged

0

You can use "save_post" action-hook Add the code below into functions.php and enchance with your comment_meta code. function update_comments_meta( $post_id ) { // Do whatever add/update_comment_meta code you need } add_action( 'save_post', 'update_comments_meta' ); UPDATE. As an example i've attach code below. It performs on post save/update ...


0

How is $_GET['post'] set ? And why are you checking it? It could be that you're adding the save_post call too late. Try: function foo() { die('Saving post'); } function foo2() { if( isset($_GET['post']) ) foo(); } add_action( 'save_post', 'foo2' );


0

Not entirely sure, but looks like Wordpress doesn't have a method to update custom fields in batches, so, 1 query to the DB per field.


0

@David explained why your code doesn't work and sketched out a solution (use save_post instead). However, you can "chain" hooks together so that you should still be able to use the transition filters to control execution: function create_recurring_posts( $ID, $post ) { add_action( 'save_post', function() { // debug, since I don't have a ...


0

Your action is triggered in wp_transition_post_status() which gets called by wp_insert_post() before the action save_post is triggered. save_post is the typical action to handle custom fields. ACF also works on this. Basically you have to wait until ACF is done with its stuff, means you'll have to hook to save_post with a priority > 10 or better use ...


0

The question is from a long time ago but, just for reference, in this particular case and if somebody simply wants to use the checked function with what seems to be an array (instead of doing the test and output 'checked` on the spot) here is a drop-in solution: checked( in_array( $shopCategory->term_id, $term_meta['ss_aff_categories'] ) ) This works ...


0

Are you sure it isn't saving the values to the DB? Perhaps it's just not displaying the previously saved values in your form? $values = get_post_custom( $post->ID ); This is what you are using to get your meta - but this returns a multi-dimensional array. Therefore when accessing your beef_meta_box_price value, you need to use ...


0

This simplest method would be to edit the data at the point it's inserted, rather than updating it afterwards, using wp_insert_post_data instead of save_post. This works on creating a new post or updating an existing post without change. add_filter( 'wp_insert_post_data' , 'modify_post_title' , '99', 2 ); // Grabs the inserted post data so you can modify ...



Top 50 recent answers are included