Category Archives: Wordpress

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; […]

Popular provider SMTP settings

Outlook.com SMTP Settings Host: smtp-mail.outlook.com Port: 587 Username: Your Outlook.com account email (e.g. john@outlook.com) Password: Your Outlook.com account password Encryption: TLS Office 365 SMTP Settings Host: smtp.office365.com Port: 587 Username: Your Office 365 account email Password: Your Office 365 account password Encryption: TLS Hotmail SMTP Settings Host: smtp.live.com Port: 587 Username: Your Hotmail account email (e.g. john@hotmail.com) Password: Your Hotmail account password Encryption: TLS Yahoo Mail SMTP Settings Host: smtp.mail.yahoo.com Port: 465 […]

Add meta box – editor for post custom meta

function wpdocs_register_meta_boxes() { add_meta_box( ‘meta-box-id’, __( ‘Backend Name’, ‘textdomain’ ), ‘wpdocs_my_display_callback’, ‘post_type’ ); } add_action( ‘add_meta_boxes’, ‘wpdocs_register_meta_boxes’ ); function wpdocs_my_display_callback( $post ) { // INPUT FIELDS GO HERE ?> <label>Year: <input type=”text” name=”inputName” value=”<?php echo get_post_meta(get_the_ID(), ‘meta_key’)[0]; ?>” /></label> <?php } /** * Save meta box content. * * @param int $post_id Post ID */ […]