Concatenate site_url and string doesn’t work

Without knowing exactly what you are trying to do, it seems you want to append query variables to the URL. WordPress has methods for handling that properly, without manual string concatenation. Look at the documentation for add_query_arg() for details: https://developer.wordpress.org/reference/functions/add_query_arg/ You can rebuild the URL and append query variables to the URL query by using … Read more

WP_Query use for a filter with multiple Taxonomies and Terms

Try this way: $args = array( ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, ‘post_status’ => ‘publish’ ); if ( isset( $_POST[‘typefilter’] ) && $_POST[‘typefilter’] !== ” ) { $args[‘post_type’] = ‘post_type_x’; $args[‘tax_query’][0][‘taxonomy’] = ‘type_emp’; $args[‘tax_query’][0][‘field’] = ‘id’; $args[‘tax_query’][0][‘terms’] = $_POST[‘typefilter’]; $args[‘tax_query’][0][‘operator’] = ‘IN’; } if ( $_POST[‘typefilter’] == ”) { $args[‘post_type’] = ‘post_type_x’; } // If … Read more

Remove commas from WooCommerce checkout addresses fields

You can remove/replace comas from address_1 and address_2 billing and shipping fields with the following, once order is submitted (before saving data): // Checkout/Order: Remove/replace comas from adresses fields add_action(‘woocommerce_checkout_create_order’, ‘remove_comas_from_address_fields’, 10, 2 ); function remove_comas_from_address_fields( $order, $data ) { $replacement=””; if ( $billing_address_1 = $order->get_billing_address_1() ) { $order->set_billing_address_1( str_replace( ‘,’, $replacement, $billing_address_1 ) ); … Read more

Replace existing content from specific WooCommerce admin orders list column

The correct filter hook to be used is manage_edit-shop_order_columns. 1) To remove shipping_address column: add_filter( ‘manage_edit-shop_order_columns’, ‘remove_specific_orders_column’ ); function remove_specific_orders_column( $columns ){ unset( $columns[‘shipping_address’] ); return $new_columns; } Code goes in functions.php file of the active child theme (or active theme). Tested and works. 2) Replace the content of shipping_address column: Here is an example … Read more

WordPress-site can be reached on x.x.x.x/index.php – but not directly on the IP without index.php

Is this normal behaviour? Yes. On a default Apache install, only index.html is set as the DirectoryIndex (the default setting). Either in the appropriate <VirtualHost> container, or main server config you need to add a <Directory> section that specifically targets the defined document root directory. For example: DocumentRoot /var/www/html <Directory “/var/www/html”> # Allow public access … Read more

Notice: wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder

You don’t need to remove the prepare(), but you just need to do it properly. And please check the $wpdb->prepare() reference for the function’s syntax etc., but basically, instead of (wrapped for brevity): $insert_query = “INSERT INTO `”.$computer_repair_items.”` VALUES(NULL, ‘”.$wc_service_name.”‘, ‘services’, ‘”.$post_id.”‘)”; $wpdb->query( $wpdb->prepare($insert_query) ); you should do it like this: (presuming $computer_repair_items is a … Read more

get understrap pagination to work with custom query

the pagination function does nothing with a custom loop That’s because for custom loops or secondary WP_Query instances like your $catquery variable, you need to explicitly tell the function how many pages are available for your custom query. So the $total argument (see the function’s description) should be set to the max_num_pages property of the … Read more