Adding revision support to WooCommerce product content

As you pointed out already there is a filter. add_filter( ‘woocommerce_register_post_type_product’, ‘wpse_modify_product_post_type’ ); function wpse_modify_product_post_type( $args ) { $args[‘supports’][] = ‘revisions’; return $args; } Put that in your child theme’s functions.php file.

post_mime_types Filter not Working in List Mode

The problem lies in the attachment-filter= URL parameter. The slash between application/pdf (or else) is being escaped twice. When you replace the %252F with a slash or %2F the filter will work. The first escaping (/ becomes %2F) happens when WP is building the selectbox containing the mime types. The second one (%2F becomes %252F) … Read more

Custom Rewrite Rules Not Sticking

I am not completely sure why this happens but I have seen it too. In my plugin Opera Speed Dial Preview I had to add the rewrite rules on init too – that fixed it. Sometimes other plugins or later visits to the permalink page may reset your custom roles … reminds me to write … Read more

xmlrpc_enabled filter not called

To remove the HTML link: remove_action( ‘wp_head’, ‘rsd_link’ ); To stop all requests to xmlrpc.php for RSD per XML-RPC: if ( defined( ‘XMLRPC_REQUEST’ ) && XMLRPC_REQUEST ) ) exit; This is plugin territory. Never use this code in a theme.

Filter media library items by size

So far, the only workable solution I’ve come up with is to run a new query within the ajax_query_attachments_args filter. It’s definitely not ideal but works as expected in the absence of a more efficient alternative: function restrict_media_library_by_width($query) { $include = array(); $exclude = array(); $temp_query = new WP_Query($query); if($temp_query->have_posts()) { while($temp_query->have_posts()) { $temp_query->the_post(); $meta … Read more

How to auto-translate custom user roles?

The translate_user_role function is just a wrapper for translate_with_gettext_context, defining the context ‘User role’. In this last function, there is the filter hook gettext_with_context, which provides the context as well as the currently used domain. So we could do this: function wpdev_141551_translate_user_roles( $translations, $text, $context, $domain ) { $plugin_domain = ‘plugin-text-domain’; $roles = array( ‘Someone’, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)