As a time saver for others, if you are using the WooCommerce Shipment Tracking plugin, I made the following change to the plugin for it to work with non-sanitized strings being stored with an update_post_meta function through another plugin, in our case through the ShipWorks plugin for WooCommerce.
echo '<option value="' . sanitize_title( $provider ) . '" ' . selected( sanitize_title( $provider ), $selected_provider, false ) . '>' . $provider . '</option>';
I changed the selected from true to false, as it should not echo in an echo.
Also I added sanitize_title to $selected_provider, since it would otherwise not match, since this is stored using all caps.
Making this change, made the plugin automatically select the correct provider stored using a non-sanitized title.
Hopefully the plugin developer will update their plugin so I can use the official version instead of my core modification.
- The topic ‘Modified WooCommerce Shipment Tracking plugin’ is closed to new replies.