The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End WordPress check other posts on publish Re: WordPress check other posts on publish


Mh… getting really close to it… Created an option, which will be set, whenever a post is published where the checkbox is checked by using this:

function set_background( $post_ID ) {
$option_name = 'my_backround' ;
$newvalue = $post_ID ;

$postMeta = get_post_meta( $post_ID, '_cf_background_set', true );
$newvalue = $postMeta;

if ( get_option( $option_name ) != $newvalue ) {
update_option( $option_name, $newvalue );
} else {
$deprecated = ' ';
$autoload = 'no';
add_option( $option_name, $newvalue, $deprecated, $autoload );
add_action('publish_background', 'set_background');
add_action('save_background', 'set_background');

But my problem is, that get_post_meta wont work immediately, it seems that calls the database entry too early… Like before it’s posted into database… Cause when I update the post 2 times, the correct value is inside, otherwise the value I had before is in there…
Anyone know how to get that work properly?