Simple CSV Exporter

Simple CSV Exporter.

Author:HAMWORKS (profile at wordpress.org)
WordPress version required:5.8
WordPress version tested:6.0.1
Plugin version:2.0.1
Added to WordPress repository:11-12-2020
Last updated:26-12-2020
Rating, %:0
Rated by:0
Plugin URI:https://github.com/team-hamworks/simple-csv-e...
Total downloads:686
Active installs:80+
plugin download
Click to start download

Simple CSV Exporter. Exported CSV can be imported with Really Simple CSV Importer.

When you select a post type, the posts will be exported.

Customize the data to be exported

Customize for column.

use HAMWORKS\WP\Simple_CSV_Exporter\Data_Builder;
add_action( 'simple_csv_exporter_created_data_builder', 
    function ( Data_Builder $data ) {
        // Remove column.
        $data->append_drop_column( 'page_template' );
        // Add custom field column.
        $data->append_meta_key( 'my_meta_key' );
    }
);

Customize posts for export.

add_action( 'simple_csv_exporter_created_data_builder_for_wp_posts_pre_get_posts', 
    function ( WP_Query $query ) {
        $query->set( 'order', 'ASC' );
    }
);

Data filter for metadata.

use HAMWORKS\WP\Simple_CSV_Exporter\Data_Builder;
add_filter( 'simple_csv_exporter_created_data_builder_for_wp_posts_get_post_meta_fields',
    function ( array $fields ) {
        foreach (
            array(
                'your_flag',
            ) as $key
        ) {
            if ( isset( $fields[ $key ] ) ) {
                $fields[ $key ] = ! empty( $fields[ $key ] ) ? 'TRUE' : 'FALSE';
            }
        }
        return $fields;
    }
);

ChangeLog