Newsletter

/** * Plugin Name: Elite Web Labs Newsletters * Description: A plugin that allows for sending newsletters when publishing posts * Version: 1.0.4 * Author: Thomas Senecal * License: GPL-2.0+ * Text Domain: newsletter */ // If this file is…Continue reading

Automatically Delete Woocommerce Images After Deleting a Product

// Automatically Delete Woocommerce Images After Deleting a Product add_action( ‘before_delete_post’, ‘delete_product_images’, 10, 1 ); function delete_product_images( $post_id ) { $product = wc_get_product( $post_id ); if ( !$product ) { return; } $featured_image_id = $product->get_image_id(); $image_galleries_id = $product->get_gallery_image_ids(); if( !empty(…Continue reading

Add ID column in admin tables

add_action( ‘admin_init’, function () { // Get all public post types $post_types = get_post_types( array(), ‘names’ ); function wpcode_add_post_id_column( $columns ) { $columns[‘wpcode_post_id’] = ‘ID’; // ‘ID’ is the column title return $columns; } function wpcode_show_post_id_column_data( $column, $post_id ) {…Continue reading

Post Meta Debugger

add_action( ‘add_meta_boxes’, function () { if ( ! current_user_can( ‘manage_options’ ) ) { // Don’t display the metabox to users who can’t manage options return; } add_meta_box( ‘wpcode-view-post-meta’, ‘Post Meta’, function () { $custom_fields = get_post_meta( get_the_ID() ); ?> Meta…Continue reading

Duplicate Post/Page Link (copy)

// Add duplicate button to post/page list of actions. add_filter( ‘post_row_actions’, ‘wpcode_snippet_duplicate_post_link’, 10, 2 ); add_filter( ‘page_row_actions’, ‘wpcode_snippet_duplicate_post_link’, 10, 2 ); // Let’s make sure the function doesn’t already exist. if ( ! function_exists( ‘wpcode_snippet_duplicate_post_link’ ) ) { /** *…Continue reading