Plugin Directory

Changeset 2466173


Ignore:
Timestamp:
02/01/2021 06:38:37 AM (5 years ago)
Author:
wokamoto
Message:

Fixed a bug that caused metadata to be deleted in Quick Edit.

Location:
wp-simple-related-posts/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • wp-simple-related-posts/trunk/admin/meta_box.php

    r1944028 r2466173  
    11<?php
    22class Simple_Related_Posts_Admin_Meta_Box {
     3    CONST NONCE_ACTION = 'SIMPLE_RELATED_POSTS';
     4    CONST NONCE_NAME = '_nonce_simple_related_posts';
     5
    36    public function __construct() {
    47        add_action( 'save_post', array( $this, 'save_post' ) );
     
    2124   
    2225    public function save_post($post_id) {
     26        // auto save の時は何もしない
    2327        if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
    2428            return;
    2529        }
     30        // WP Cron API で呼び出された時は何もしない
    2631        if ( wp_doing_cron() ) {
    2732            return;
     33        }
     34        // nonce field がなければ何もしない
     35        if ( !isset( $_POST[self::NONCE_NAME] ) || !wp_verify_nonce( $_POST[self::NONCE_NAME], self::NONCE_ACTION ) ) {
     36            return;
     37        }
     38
     39        // リビジョンなら本物の投稿の ID を取得
     40        if ( $parent_id = wp_is_post_revision( $post_id ) ) {
     41            $post_id = $parent_id;
    2842        }
    2943
     
    103117    public function meta_box() {
    104118        global $simple_related_posts;
    105                
     119
     120        wp_nonce_field( self::NONCE_ACTION, self::NONCE_NAME );
    106121        ?>
    107122<div class="sirp_relationship" >
  • wp-simple-related-posts/trunk/readme.txt

    r2034720 r2466173  
    33Tags:  related posts,related
    44Requires at least: 3.8.1
    5 Tested up to: 5.0.3
    6 Stable tag: 1.5.7
     5Tested up to: 5.6
     6Stable tag: 1.5.8
    77
    88Related Posts plugin. It's flexible and fast and simple.
     
    8585= 1.5.7 =
    8686* Fixed warning errors
     87= 1.5.8 =
     88* Fixed a bug that caused metadata to be deleted in Quick Edit.
  • wp-simple-related-posts/trunk/simple-related-posts.php

    r2034720 r2466173  
    55Description: Display Related Posts. Very Simple.
    66Author: digitalcube
    7 Version: 1.5.7
     7Version: 1.5.8
    88Author URI: https://github.com/megumiteam/wp-simple-related-posts
    99Text Domain: simple-related-posts
Note: See TracChangeset for help on using the changeset viewer.