首頁>Web>source

如何仅使用SQL查詢删除由其ID標識的特定帖子的帖子修订?

最新回復
  • 5月前
    1 #

    如果需要SQL查詢,則此選項應该合適

    function src_flush_revisions () {
        global $wpdb;
        $post_id = 5//exp post id
        if ( isset( $timeLimit ) ) {
            $revision_ids = $wpdb->get_col( $wpdb->prepare( "SELECT `ID` FROM $wpdb->posts WHERE `post_type` = 'revision' AND `post_parent` = %d", $post_id ) );
            foreach ( $revision_ids as $revision_id ) {
                wp_delete_post_revision( $revision_id );
            }
        }
    }
    add_action( 'admin_init', 'src_flush_revisions' );
    
    

  • wordpress:如果未登錄,則排队的樣式將被註釋
  • wordpress:wordpress音频播放器有两種不同的樣式