Adding rows when new user is created
Adding rows when new user is created
Adding rows when new user is created
Try this in your functions.php file: add_action(‘save_post’, ‘wpb_autogenerate_events_title’, 10, 3); function wpb_autogenerate_events_title($post_id, $post, $update) { // Check if it’s the ‘events’ CPT and if the title is empty. if (‘events’ !== $post->post_type || !empty($post->post_title)) { return; } // Fetch terms from ‘category’ and ‘nameselection’ taxonomies. $category_term = wp_get_post_terms($post_id, ‘category’, [‘fields’ => ‘names’]); $nameselection_term = wp_get_post_terms($post_id, … Read more
For something like this I would use bash scripting, it works great and will do anything for you. If we assume that the server environment (Nginx, MySQL, PHP) is already set up and configured, the bash script will focus solely on downloading, installing, and configuring WordPress. Here’s a simplified script for that purpose: WordPress Installation … Read more
To achieve the behavior you’re describing in WordPress, where a cron job runs hourly but only between 2 AM and 5 AM, you have a couple of options. While WordPress doesn’t offer this level of specificity in its default scheduling, you can customize it to suit your needs. Custom Cron Scheduling: This involves creating a … Read more
This is pretty straight forward and easy to do with $wpdb and SQL statement the relationship between any post type (custom or not) and taxonomy term (custom or not ) are stored wp_term_relationships table which has object_id and term_id all you have to do is query the record that has the term_id for active1 term … Read more
How to delete posts with incorrect status
An script/Plugin for automatic page creation per term
Check out TGM-Plugin-Activation plugin. TGM Plugin Activation is a PHP library that allows you to easily require or recommend plugins for your WordPress themes (and plugins). It allows your users to install and even automatically activate plugins in singular or bulk fashion using native WordPress classes, functions and interfaces. You can reference pre-packaged plugins, plugins … Read more
Delete old thumbnail when updating new
Rather than update the database you could write a mu-plugin to intercept reads from the active_plugins option, e.g. function option_active_plugins_akismet_or_yoast( $plugins ) { if ( !defined(‘WP_ADMIN’) ) { $hour = getdate()[ ‘hours’ ]; if ( $hour >= 10 && $hour < 19 ) { $to_remove=”wordpress-seo/wp-seo.php”; } else { $to_remove=”akismet/akismet.php”; } $remove_index = array_search( $to_remove, $plugins … Read more