文件操作 - PostData.php
返回文件管理
返回主菜单
删除本文件
文件: /home/www/public/wp-content/plugins/ionos-loop/inc/data/core/PostData.php
编辑文件内容
<?php namespace Ionos\Loop\Data\Core; use Ionos\Loop\Data\DataProvider; /** * Data provider for posts and any post types. */ class PostData extends DataProvider { /** * Collects all post/post type related data. * * @return array */ protected function collect_data() { global $wpdb; $post_types = get_post_types( [], 'objects' ); $parsed_post_types = []; foreach ( $post_types as $post_type ) { $count = $wpdb->get_var( $wpdb->prepare( 'SELECT count(ID) as count FROM ' . $wpdb->posts . ' WHERE post_type = %s AND post_status != %s AND post_status != %s LIMIT 1', $post_type->name, 'trash', 'revision' ) ); $parsed_post_types[] = [ 'name' => $post_type->name, 'count' => (int) $count, ]; } return $parsed_post_types; } }
修改文件时间
将文件时间修改为当前时间的前一年
删除文件