• Resolved pete-sch

    (@pete-sch)


    Your Ad saving code uses the WordPress database directly, which skips invalidating the post in the object cache (if there is one activated).

    Using any object cache plugin (eg.: Redis Object Cache: 1.2) causes the Ad editor to show the last cached post_content the Ad content editor.

    You can easily avoid this, there is a quick fix:

    classes/ads.php

    Take the save code

    public function save(){
    		global $wpdb;
    
    		// remove slashes from content
    		$content = $this->prepare_content_to_save();
    
    		$where = array('ID' => $this->id);
    		$wpdb->update( $wpdb->posts, array( 'post_content' => $content ), $where );

    and add a clean_post_cache call direcly after $wpdb->update:

    // clean post from object cache
            clean_post_cache( $this->id );

    https://ww.wp.xz.cn/plugins/advanced-ads/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Thomas Maier

    (@webzunft)

    Hi pete-sch,

    thank you for taking the time to find the problem and provide me with a solution. Much appreciated!

    I will give it a try once I am back from my trip. Just want to dig a bit deeper into it before adding the solution to the core. It might even help me to improve other parts in the code.

    Thanks
    Thomas

    Plugin Author Thomas Maier

    (@webzunft)

    Hi pete-sch,

    I added the fix to version 1.6.2 that was just published. Thanks again for your help!
    Thomas

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Object cache conflict: Breaks Ad saving’ is closed to new replies.