Proper Prepare Statement for ALTER TABLE and using AFTER

Answer to this question actually comes from @TomJNowell. Instead of using MySQL calls, use the native functions included with WordPress: update_post_meta ( $post->ID , ‘forum_id’, $thread_id ); where the forum_id is the key and the $thread_id is the value. I tried add_post_meta but that created duplicates. To retrieve the meta data $thread_id = get_post_custom_values( ‘thread_id’, … Read more

Disable variations on woo commerce if out of stock

Managed to solve my own issue. Simply paste the following into functions.php function custom_wc_ajax_variation_threshold( $qty, $product ) { return 10; } add_filter( ‘woocommerce_ajax_variation_threshold’, ‘custom_wc_ajax_variation_threshold’, 10, 2 ); Then change the ‘return 10;’ to however many variations you have. Please note this may slow down page loading time depending on your hosting.

Unable to give correct path in wordpress

Use: get_template_directory() and or get_stylesheet_directory() E.g. in zumper/layouts/america.php <?php include get_template_directory() . ‘/inc/york.php’; //etc… Note: get_template_directory Retrieves the absolute path to the directory of the current theme. get_stylesheet_directory Retrieve stylesheet directory Path for the current theme/child theme. So if your theme is a child theme and or you want to provide the ability for a … Read more