<span> – </span> being add to variable product post_title data
-
Hi all,
I can’t figure out for the life of me why when adding a product variation it is adding <span> – </span> to the database entry in the posts table post_title=>data column.
I’ve tried to do an add_filter for a fair few different functions, does anyone know which one specifically is called when adding a product variation and what the code might be? I adapted a code snippet for a similar issue from elsewhere, and am using as below
add_filter(‘WHICH_FUNCTION_HERE?’, function ($value, $order, $item, $product,$item_meta) {
return str_replace( “<span> – </span>”, ” – “,$value);
}, 10, 5);The page is currently only accessible by whitelisted IPs.
Any help is much appreciated.
Kind regards
-
This topic was modified 4 years, 7 months ago by
oriwittmer.
-
This topic was modified 4 years, 7 months ago by
oriwittmer.
-
This topic was modified 4 years, 7 months ago by
oriwittmer.
The page I need help with: [log in to see the link]
-
This topic was modified 4 years, 7 months ago by
-
Hey there!
Could you please share a copy of your site’s System Status? You can find it via WooCommerce > Status.
Select “Get system report” and then “Copy for support”.? Once you’ve done that, paste it here in your response.### WordPress Environment ### WordPress address (URL): https://www.sannaandco.com.au Site address (URL): https://www.sannaandco.com.au WC Version: 4.3.0 REST API Version: ? 1.0.10 WC Blocks Version: ? 2.7.1 Action Scheduler Version: ? 3.1.6 WC Admin Version: ? 1.3.0 Log Directory Writable: ? WP Version: 5.4.2 WP Multisite: – WP Memory Limit: 256 MB WP Debug Mode: – WP Cron: ? Language: en_AU External object cache: – ### Server Environment ### Server Info: Apache PHP Version: 7.3.15 PHP Post Max Size: 100 MB PHP Time Limit: 360 PHP Max Input Vars: 1000 cURL Version: 7.61.1 OpenSSL/1.0.2k SUHOSIN Installed: – MySQL Version: 5.7.22 Max Upload Size: 100 MB Default Timezone is UTC: ? fsockopen/cURL: ? SoapClient: ? DOMDocument: ? GZip: ? Multibyte String: ? Remote Post: ? Remote Get: ? ### Database ### WC Database Version: 4.3.0 WC Database Prefix: sac_ Total Database Size: 11.42MB Database Data Size: 8.40MB Database Index Size: 3.02MB sac_woocommerce_sessions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB sac_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB sac_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB sac_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB sac_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB sac_woocommerce_order_itemmeta: Data: 0.06MB + Index: 0.03MB + Engine InnoDB sac_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB sac_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB sac_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB sac_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB sac_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB sac_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB sac_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB sac_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB sac_actionscheduler_actions: Data: 0.09MB + Index: 0.11MB + Engine InnoDB sac_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB sac_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB sac_actionscheduler_logs: Data: 0.08MB + Index: 0.03MB + Engine InnoDB sac_bdp_archives: Data: 0.02MB + Index: 0.00MB + Engine InnoDB sac_bdp_edd_archives: Data: 0.02MB + Index: 0.00MB + Engine InnoDB sac_bdp_product_archives: Data: 0.02MB + Index: 0.00MB + Engine InnoDB sac_bdp_single_ed_download: Data: 0.02MB + Index: 0.00MB + Engine InnoDB sac_bdp_single_layouts: Data: 0.02MB + Index: 0.00MB + Engine InnoDB sac_bdp_single_product: Data: 0.02MB + Index: 0.00MB + Engine InnoDB sac_blog_designer_pro_shortcodes: Data: 0.03MB + Index: 0.00MB + Engine InnoDB sac_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB sac_comments: Data: 0.02MB + Index: 0.09MB + Engine InnoDB sac_csshero4: Data: 0.11MB + Index: 0.00MB + Engine InnoDB sac_eg_grids: Data: 0.06MB + Index: 0.02MB + Engine InnoDB sac_eg_item_elements: Data: 0.02MB + Index: 0.02MB + Engine InnoDB sac_eg_item_skins: Data: 0.25MB + Index: 0.03MB + Engine InnoDB sac_eg_navigation_skins: Data: 0.05MB + Index: 0.02MB + Engine InnoDB sac_em_modals: Data: 0.02MB + Index: 0.00MB + Engine InnoDB sac_em_modal_metas: Data: 0.02MB + Index: 0.00MB + Engine InnoDB sac_em_themes: Data: 0.02MB + Index: 0.00MB + Engine InnoDB sac_em_theme_metas: Data: 0.02MB + Index: 0.00MB + Engine InnoDB sac_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB sac_mailchimp_carts: Data: 0.02MB + Index: 0.00MB + Engine InnoDB sac_mailchimp_jobs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB sac_ms_snippets: Data: 0.02MB + Index: 0.00MB + Engine InnoDB sac_options: Data: 4.02MB + Index: 0.14MB + Engine InnoDB sac_postmeta: Data: 0.34MB + Index: 0.28MB + Engine InnoDB sac_posts: Data: 1.05MB + Index: 0.06MB + Engine InnoDB sac_snippets: Data: 0.02MB + Index: 0.00MB + Engine InnoDB sac_social_users: Data: 0.02MB + Index: 0.02MB + Engine InnoDB sac_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB sac_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB sac_term_relationships: Data: 0.02MB + Index: 0.02MB + Engine InnoDB sac_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB sac_trp_dictionary_en_au_fi: Data: 0.11MB + Index: 0.11MB + Engine InnoDB sac_trp_dictionary_en_au_fi_sa: Data: 0.02MB + Index: 0.05MB + Engine InnoDB sac_trp_gettext_en_au: Data: 0.33MB + Index: 0.41MB + Engine InnoDB sac_trp_gettext_fi: Data: 0.38MB + Index: 0.33MB + Engine InnoDB sac_trp_gettext_fi_sa: Data: 0.08MB + Index: 0.08MB + Engine InnoDB sac_trp_original_meta: Data: 0.06MB + Index: 0.05MB + Engine InnoDB sac_trp_original_strings: Data: 0.08MB + Index: 0.06MB + Engine InnoDB sac_usermeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB sac_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB sac_wc_admin_notes: Data: 0.02MB + Index: 0.00MB + Engine InnoDB sac_wc_admin_note_actions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB sac_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB sac_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB sac_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB sac_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB sac_wc_order_product_lookup: Data: 0.02MB + Index: 0.06MB + Engine InnoDB sac_wc_order_stats: Data: 0.02MB + Index: 0.05MB + Engine InnoDB sac_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB sac_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB sac_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB sac_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB sac_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB sac_woocommerce_square_customers: Data: 0.02MB + Index: 0.00MB + Engine InnoDB sac_wpmailsmtp_emails_log: Data: 0.06MB + Index: 0.03MB + Engine InnoDB sac_wpmailsmtp_tasks_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB sac_yith_wcwl: Data: 0.02MB + Index: 0.02MB + Engine InnoDB sac_yith_wcwl_lists: Data: 0.02MB + Index: 0.03MB + Engine InnoDB ### Post Type Counts ### attachment: 31 blocks: 11 customize_changeset: 82 elementor_library: 1 featured_item: 8 language_switcher: 3 nav_menu_item: 11 page: 17 polylang_mo: 2 post: 16 product: 13 product_variation: 8 revision: 81 shop_order: 38 wpcf7_contact_form: 5 ### Security ### Secure connection (HTTPS): ? Hide errors from visitors: ? ### Active Plugins (18) ### Blog Designer PRO: by Solwin Infotech – 2.7.1 Code Snippets: by Code Snippets Pro – 2.14.0 Contact Form 7: by Takayuki Miyoshi – 5.2 CSS Hero: by The CSS Hero Team – 4.20 Currency Switcher for WooCommerce: by WP Wham – 2.12.1 – Installed version not tested with active version of WooCommerce 4.3.0 Essential Grid: by ThemePunch – 2.3.6 Facebook for WooCommerce: by Facebook – 1.11.4 – Installed version not tested with active version of WooCommerce 4.3.0 Jetpack by WordPress.com: by Automattic – 8.6.1 Google Ads for WooCommerce: by Kliken – 1.0.4 – Installed version not tested with active version of WooCommerce 4.3.0 Mailchimp for WooCommerce: by Mailchimp – 2.4.1 – Installed version not tested with active version of WooCommerce 4.3.0 TranslatePress - Custom Sami Language: by Cristian Antohe – 1.0 TranslatePress - Multilingual: by Cozmoslabs Razvan Mocanu Madalin Ungureanu Cristophor Hurduban – 1.7.8 – Installed version not tested with active version of WooCommerce 4.3.0 WooCommerce Composite Products: by SomewhereWarm – 7.0.4 WooCommerce Shipment Tracking: by WooCommerce – 1.6.23 – Installed version not tested with active version of WooCommerce 4.3.0 WooCommerce Australia Post Shipping: by WooCommerce – 2.4.25 – Installed version not tested with active version of WooCommerce 4.3.0 WooCommerce Square: by WooCommerce – 2.1.6 WooCommerce: by Automattic – 4.3.0 WP Mail SMTP Pro: by WPForms – 2.2.1 ### Inactive Plugins (12) ### Akismet Anti-Spam: by Automattic – 4.1.5 Easy Modal: by Daniel Iser – 2.1.0 Elementor: by Elementor.com – 2.9.13 Elementor Pro: by Elementor.com – 2.10.3 GTranslate: by Translate AI Multilingual Solutions – 2.8.55 Nextend Social Login: by Nextendweb – 3.0.24 Polylang: by WP SYNTEX – 2.7.4 WooCommerce Email Customizer: by WooCommerce – 1.1.16 – Installed version not tested with active version of WooCommerce 4.3.0 WooCommerce Quick View: by WooCommerce – 1.2.10 – Installed version not tested with active version of WooCommerce 4.3.0 WooCommerce Services: by Automattic – 1.23.2 – Installed version not tested with active version of WooCommerce 4.3.0 Woo Quick View: by Arshid – 1.1.0 YITH WooCommerce Wishlist: by YITH – 3.0.11 – Installed version not tested with active version of WooCommerce 4.3.0 ### Must Use Plugins (1) ### rms_unique_wp_mu_pl_fl_nm.php: by – ### Settings ### API Enabled: – Force SSL: – Currency: AUD ($) Currency Position: left Thousand Separator: , Decimal Separator: . Number of Decimals: 2 Taxonomies: Product Types: composite (composite) external (external) grouped (grouped) simple (simple) variable (variable) Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog) exclude-from-search (exclude-from-search) featured (featured) outofstock (outofstock) rated-1 (rated-1) rated-2 (rated-2) rated-3 (rated-3) rated-4 (rated-4) rated-5 (rated-5) Connected to WooCommerce.com: – ### WC Pages ### Shop base: ? Page not set Cart: #64 - /cart/ Checkout: #63 - /checkout/ My account: #62 - /my-account/ Terms and conditions: ? Page not set ### Theme ### Name: Flatsome Child Version: 3.0 Author URL: Child Theme: ? Parent Theme Name: Flatsome Parent Theme Version: 3.12.0 Parent Theme Author URL: https://www.uxthemes.com/ WooCommerce Support: ? ### Templates ### Overrides: flatsome/woocommerce/archive-product.php flatsome/woocommerce/cart/cart-empty.php flatsome/woocommerce/cart/cart-shipping.php flatsome/woocommerce/cart/cart.php flatsome/woocommerce/checkout/form-checkout.php flatsome/woocommerce/checkout/form-coupon.php flatsome/woocommerce/checkout/terms.php flatsome/woocommerce/checkout/thankyou.php flatsome/woocommerce/content-product.php flatsome/woocommerce/content-product_cat.php flatsome/woocommerce/content-single-product.php flatsome/woocommerce/content-widget-product.php flatsome-child/woocommerce/emails/customer-completed-order.php flatsome-child/woocommerce/emails/plain/customer-completed-order.php flatsome/woocommerce/global/breadcrumb.php flatsome/woocommerce/global/quantity-input.php flatsome/woocommerce/global/wrapper-end.php flatsome/woocommerce/global/wrapper-start.php flatsome/woocommerce/loop/loop-end.php flatsome/woocommerce/loop/loop-start.php flatsome/woocommerce/loop/pagination.php flatsome/woocommerce/loop/result-count.php flatsome/woocommerce/loop/sale-flash.php flatsome/woocommerce/myaccount/form-login.php flatsome/woocommerce/myaccount/navigation.php flatsome/woocommerce/notices/error.php flatsome/woocommerce/notices/notice.php flatsome/woocommerce/notices/success.php flatsome/woocommerce/product-searchform.php flatsome/woocommerce/single-product/photoswipe.php flatsome/woocommerce/single-product/price.php flatsome/woocommerce/single-product/product-image.php flatsome/woocommerce/single-product/product-thumbnails.php flatsome/woocommerce/single-product/rating.php flatsome/woocommerce/single-product/related.php flatsome/woocommerce/single-product/review.php flatsome/woocommerce/single-product/sale-flash.php flatsome/woocommerce/single-product/share.php flatsome/woocommerce/single-product/short-description.php flatsome/woocommerce/single-product/tabs/tabs.php flatsome/woocommerce/single-product/title.php flatsome/woocommerce/single-product/up-sells.php flatsome/woocommerce/single-product-reviews.php flatsome/woocommerce/single-product.php ### Composite Products ### Database Version: 7.0.4 Loopback Test: ? Template Overrides: – ### Square ### Environment: Production Tokenization Enabled: – Debug Mode: Off ### Action Scheduler ### Complete: 216 Oldest: 2020-07-17 03:38:38 +0000 Newest: 2020-07-20 12:57:56 +0000 Pending: 3 Oldest: 2020-07-20 13:57:56 +0000 Newest: 2020-07-24 04:13:02 +0000
I believe this is the create function I’m trying to filter (from class-wc-product-variation-data-store-cpt.php)
/**
* Create a new product.
*
* @since 3.0.0
* @param WC_Product_Variation $product Product object.
*/
public function create( &$product ) {
if ( ! $product->get_date_created() ) {
$product->set_date_created( time() );
}$new_title = $this->generate_product_title( $product );
if ( $product->get_name( ‘edit’ ) !== $new_title ) {
$product->set_name( $new_title );
}$attribute_summary = $this->generate_attribute_summary( $product );
$product->set_attribute_summary( $attribute_summary );// The post parent is not a valid variable product so we should prevent this.
if ( $product->get_parent_id( ‘edit’ ) && ‘product’ !== get_post_type( $product->get_parent_id( ‘edit’ ) ) ) {
$product->set_parent_id( 0 );
}$id = wp_insert_post(
apply_filters(
‘woocommerce_new_product_variation_data’,
array(
‘post_type’ => ‘product_variation’,
‘post_status’ => $product->get_status() ? $product->get_status() : ‘publish’,
‘post_author’ => get_current_user_id(),
‘post_title’ => $product->get_name( ‘edit’ ),
‘post_excerpt’ => $product->get_attribute_summary( ‘edit’ ),
‘post_content’ => ”,
‘post_parent’ => $product->get_parent_id(),
‘comment_status’ => ‘closed’,
‘ping_status’ => ‘closed’,
‘menu_order’ => $product->get_menu_order(),
‘post_date’ => gmdate( ‘Y-m-d H:i:s’, $product->get_date_created( ‘edit’ )->getOffsetTimestamp() ),
‘post_date_gmt’ => gmdate( ‘Y-m-d H:i:s’, $product->get_date_created( ‘edit’ )->getTimestamp() ),
‘post_name’ => $product->get_slug( ‘edit’ ),
)
),
true
);if ( $id && ! is_wp_error( $id ) ) {
$product->set_id( $id );$this->update_post_meta( $product, true );
$this->update_terms( $product, true );
$this->update_visibility( $product, true );
$this->update_attributes( $product, true );
$this->handle_updated_props( $product );$product->save_meta_data();
$product->apply_changes();$this->update_version_and_type( $product );
$this->update_guid( $product );$this->clear_caches( $product );
do_action( ‘woocommerce_new_product_variation’, $id, $product );
}
}Though my PHP knowledge is limited and I’m not sure how to wp_strip_tags or str_replace on it with an add_filter or add_action
Hello @oriwittmer,
Thanks for posting your system status logs. While looking up the logs, I noticed the following must use plugin:
rms_unique_wp_mu_pl_fl_nm.php
According to https://wordpress.stackexchange.com/questions/366956/rms-unique-wp-mu-pl-fl-nm-php, this seems to be a malicious file. I strongly recommend that you delete that file immediately and scan your site for additional malicious files.
Regarding your reported problem with
<span> – </span>
being added, I was unable to reproduce this on a fresh test sit with only WooCommerce installed and the Storefront theme activated. I suggest that you switch to a WordPress default theme such as the Twenty Twenty or the Storefront theme, to see if the current problem is related to your theme. If this does not solve the problem, then please deactivate all plugins except the WooCommerce plugin, to see if any of your other plugins is causing this issue.Hi Niels,
Thanks for the heads up regarding the malware. It looks like I’ll have to do a fresh install and see which plugin is installing it. Apparently it often comes from nulled plugins but none of those I’ve installed are nulled, though there is 1 or 2 independently published plugins that may be the culprit. It seems I will also have to seek a credit charge reversal or fraud.
I have narrowed down the <span> issue to being caused by TranslatePress. I will follow up with their support.
Thank you very much for your help.
Kind regards
Hey @andrewmcbride! Can you please start a new thread for your issue? This thread has already been marked as resolved and is a month old, so folks aren’t likely to see that you need help. Creating a new thread would be the best way to get some attention on your issue
- The topic ‘<span> – </span> being add to variable product post_title data’ is closed to new replies.