Cho mình hỏi cách xóa dữ liệu có cấu trúc mặc định của wordpress được thêm bởi themes code của WooCommerce và Yoast SEO plugin như thế nào vậy? mình muốn xóa toàn bộ các thẻ dữ liệu có cấu trúc đi thì làm sao khi muốn xóa nó bằng code trọng functions.php của themes? Xóa các js code sau: và nhiều cái khác nữa Mã: https://schema.org/Product https://schema.org/WebPage WooCommerce to Remove schema.org Markup from Product Categories, Remove the WooCommerce JSON/LD Structured Data Format
Để xóa tất cả các thẻ cấu trúc dữ liệu của SEO Yoast bạn thêm code sau vào Functions.php Mã: function disable_yoast_schema_data($data){ $data = array(); return $data; } add_filter('wpseo_json_ld_output', 'disable_yoast_schema_data', 10, 1); Để xóa tất cả các thẻ cấu trúc dữ liệu của WooCommerce bạn thêm code sau vào Functions.php Mã: function remove_output_structured_data() { remove_action( 'wp_footer', array( WC()->structured_data, 'output_structured_data' ), 10 ); // This removes structured data from all frontend pages remove_action( 'woocommerce_email_order_details', array( WC()->structured_data, 'output_email_structured_data' ), 30 ); // This removes structured data from all Emails sent by WooCommerce } add_action( 'init', 'remove_output_structured_data' );
Code trên không áp dụng được cho bản WooCommerce bản 3.6.5 mới nhất bác à. Bản trước đó em add code này thì ok. Bác xem có cao kiến gì không?