retrieve current user meta data (custom fields included)
Have you tried get_user_meta($user_id, $key, $single);? https://codex.wordpress.org/Function_Reference/get_user_meta
Have you tried get_user_meta($user_id, $key, $single);? https://codex.wordpress.org/Function_Reference/get_user_meta
To reset quantity input field to 1 when variation changes on product detail page use below code. you can set default quantity from jQuery(“[name=”quantity”]”).val(1);. i have tested and it is working fine for me. add_action( ‘wp_footer’, ‘variation_change_update_qty’ ); function variation_change_update_qty() { if (is_product()) { ?> <script> jQuery(function($){ $( “.variations_form” ).on( “woocommerce_variation_select_change”, function () { jQuery(“[name=”quantity”]”).val(1); … Read more
The way the function is written, the default values are not editable from within the plugin as there is no filter hook to alter them. However, this is a specific “attribute” of the shortcode. shortcode_atts() is a function that defines the shortcode’s attributes (which can be passed through the shortcode itself) and sets their default … Read more
I would try changing your line in wp-config.php to define( ‘UPLOADS’, ‘media/blog/files’ ); // where docker is mounted Ie, get rid of the first /. Let me know if this works. EDIT If you can’t change the definition of UPLOADS you could strip out the forward slash out with code. Try changing your code to … Read more
That’s only one way to achieve that, but it’s the easiest, I guess. The taxonomy UI is displayed as list of checkboxes, if given taxonomy is hierarchical. So if you change the product tags to hierarchical, it will solve your problem. And it’s pretty easy to change, because there’s a hook for that: function my_woocommerce_make_tags_hierarchical( … Read more
You can use wp_head. This will insert the script in the head. function dropin_location() { if ( is_page( 7 ) ) { ?> <script>alert(‘got here’)</script>’ <?php } } add_action(‘wp_head’, ‘dropin_location’); However, there are other ways to add scripts. You can have it as a script file in your theme and enqueue it so that WordPress … Read more
Use this code to require the file from your theme’s functions.php file: require get_template_directory() . ‘includes/dashboard.php’; For the sake of completeness (and sanity) my dashboard.php file lives here: my-theme/includes/dashboard.php I took a closer look at the original issue, and I think what’s happening is that the require statement is silently failing because the wp-admin/includes/dashboard.php file … Read more
In your child theme (which I am assuming you are using) functions.php file: function wpse_356175_assets() { wp_dequeue_style( ‘media-queries’ ); } add_action( ‘wp_enqueue_scripts’, ‘wpse_356175_assets’ ); Utilise wp_dequeue_style and or wp_deregister_style depending on how the stylesheet was registered/enqueued. If necessary adjust the priority of your action to fire after the registered/enqueued file from the parent theme, e.g: … Read more
Option 1: force featured image on all posts Use the save_post hook, which runs twice per “save” action if you have revisions enabled. You can verify it’s the final run by checking that there is $_POST data (it’s empty the first time around). add_action(‘save_post’, ‘wpse_force_featured_image’, 20, 2); function wpse_force_featured_image($post_id, $post) { // If this is … Read more
If you want to create a particular page once, then you can save an option to the database once the page has been created, then check if that value exists before attempting to recreate it. If you store the page’s ID, you can also check if the post still exists and recreate it if it … Read more