Generate WordPress plugin Credits: johnofhousejohn

Input:

Create a custom WordPress plugin called "Big Daddy Media" that deletes images older than one year from the media library. OOP. Custom admin screen. one button delete. log the full URL of all deleted media files.

Output:

Here is an example of how you could create a custom WordPress plugin called "Big Daddy Media" that deletes images older than one year from the media library: 1. Create a new folder in the `wp-content/plugins` directory and name it `big-daddy-media`. 2. Create a new file in this folder and name it `big-daddy-media.php`. This file will contain the main code for your plugin. 3. At the top of the `big-daddy-media.php` file, add the plugin header information: Copy code ` 'attachment', 'post_status' => 'inherit', 'date_query' => array( array( 'before' => '1 year ago', ), ), ) ); // delete the images from the media library foreach ( $older_than_one_year->posts as $image ) { $deleted = wp_delete_attachment( $image->ID, true ); if ( $deleted ) { // log the full URL of the deleted image error_log( wp_get_attachment_url( $image->ID ) ); } } }` 7. Use the `add_action` function to register the `admin_menu` action, which will be used to add a custom admin screen for your plugin. In the callback function for this action, use the `add_management_page` function to add a new menu item to the "Tools" menu in the WordPress admin dashboard. Copy code `add_action('admin_menu',`

Browse Entire ChatGPT usecase list

Assistant

Automation

Clothing & Apparel

Content Creation

Cooking

Creativity & Experiments

Customer Support

Data

Design

Exam & Competition

Fitness

Games

Grammar

Healthcare

Home

Jailbreak / Tricks / Hacks

Language

Learning

Machine Learning

Marketing

Music

Opinion

Product

Programming

Prompt Writing

Search Engine

SEO

Startups

Writing