Author Archives: Wojciech Borowicz

Missing theme/plugin editor

Theme or plugin editor are posing a risk to security, at least according to people a lot smarter than me! Many auto-installers, hostings, security plugins are amending wp-config file by adding a couple of constants. If you cannot see theme/plugin editor, check your wp-config.php file for the following lines: define( ‘DISALLOW_FILE_EDIT’, true ); define( ‘DISALLOW_FILE_MODS’, […]

Cron Job for removing expired MEC events

register_activation_hook(__FILE__, ‘wojciech_borowicz_mec_cron_job_schedule’); function wojciech_borowicz_mec_cron_job_schedule() { if (! wp_next_scheduled ( ‘wojciech_borowicz_remove_expired_events_cron_job’ )) { wp_schedule_event(time(), ‘daily’, ‘wojciech_borowicz_remove_expired_events_cron_job’); } } add_action(‘wojciech_borowicz_remove_expired_events_cron_job’, ‘wojciech_borowicz_remove_expired_events’); function wojciech_borowicz_remove_expired_events() { $args = array( ‘post_type’ => ‘mec-events’, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, ‘posts_per_page’=> ‘-1’, ); $loop = new WP_Query( $args ); if( $loop->have_posts() ): $today = date(‘Y-m-d’); while( $loop->have_posts() ): $loop->the_post(); global $post; […]