How to pass parameters in wordpress shortcode?

As the docs for add_shortcode() state, Every shortcode callback is passed three parameters by default, including an array of attributes ($atts), the shortcode content or null if not set ($content), and finally the shortcode tag itself ($shortcode_tag), in that order. Use the shortcode_atts() to define what attributes are allowed and set default values for those … Read more

Get current user id in function php

You’re running your code on the wp_loguout hook, which is after the user has logged out, so of course there’s no current user ID. There’s no current user at all. If you look at the documentation for the wp_logout hook, you will see that the ID of the user that was logged out is passed … Read more

Dropdown Category form. Only show Sub-Categories

You just need to set the parent argument of get_categories() (or better yet, get_terms() to the ID of the the-building-code term. If you don’t know the ID you’ll need to retrieve that first: <form class=”js-filter-form”> <select name=”categories” id=”categories”> <?php $parent = get_term_by( ‘slug’, ‘the-building-code’, ‘podcast_category’ ); $cat_args = array( ‘taxonomy’ => ‘podcast_category’, ‘parent’ => $parent->term_id, … Read more

Run a sql (update) after 12 hours after the user login. Woocommerce users

You could do something like this (this code has not been testedt). function schedule_sql_command($user_login, $user) { // 12 hours in seconds. $from_now = 12 * 60 * 60; // schedule a call to a custom hook passing in the user’s ID wp_schedule_single_event(time() + $from_now, ‘run_sql_command’, array( $user->ID) ); } // this is the custom hook … Read more