PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 4.0.8
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v4.0.8
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 2.3.5 2.3.6 2.4.0 2.4.1 2.4.10 2.4.11 2.4.12 2.4.13 2.4.14 2.4.15 2.4.16 2.4.17 2.4.18 2.4.19 2.4.2 2.4.20 2.4.21 All 88 releases
post-carousel / includes / updates / update-2.4.13.php

update-2.4.13.php in Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News 4.0.8, at includes/updates/update-2.4.13.php

48 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * This file is used to update the database version of the plugin.
4 *
5 * @link https://wpsmartpost.com/
6 * @since 2.4.13
7 *
8 * @package Smart_Post_Show
9 * @subpackage Smart_Post_Show/includes
10 */
11
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit; // Exit if accessed directly.
14 }
15
16 update_option( 'smart_post_show_version', '2.4.13' );
17 update_option( 'smart_post_show_db_version', '2.4.13' );
18
19 /**
20 * Update settings.
21 */
22 $args = new \WP_Query(
23 array(
24 'post_type' => array( 'page' ),
25 'post_status' => 'publish',
26 'posts_per_page' => '300',
27 )
28 );
29 $post_ids = wp_list_pluck( $args->posts, 'ID' );
30 if ( count( $post_ids ) > 0 ) {
31 add_filter( 'wp_revisions_to_keep', '__return_false' );
32 foreach ( $post_ids as $post_key => $pid ) {
33 $post_data = get_post( $pid );
34 $post_content = isset( $post_data->post_content ) ? $post_data->post_content : '';
35 if ( ! empty( $post_content ) && ( strpos( $post_content, 'wp:smart-post-show' ) !== false ) ) {
36 $post_content = preg_replace( '/wp:smart-post-show\/shortcode/i', 'wp:smart-post-show-pro/shortcode', $post_content );
37
38 $gutenberg_post = array(
39 'ID' => $pid,
40 'post_content' => $post_content,
41 );
42 // Update the post into the database.
43 $pid = wp_update_post( $gutenberg_post );
44
45 }
46 }
47 }
48