• Last issue I came across(this might be related to my end of stick;-)

    I have added such code to functions.php

    function a13_minfy($opts){
        var_dump('fancyString',$opts);
        $opts = array_merge($opts, array('disable_if_wp_debug' => false));
        return $opts;
    }
    add_filter( 'dependency_minification_options', 'a13_minfy');

    I added even var_dump cause I couldn’t find out why it is not making any difference(still it didn’t fire).
    Am I doing something wrong?

    Plugin started to work when I did change in its code in 'disable_if_wp_debug' => false or when I switched off WP_DEBUG.

    I wonder what is going on here:-)

    With regards.

    http://wordpress.org/plugins/dependency-minification/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Weston Ruter

    (@westonruter)

    Air:

    I just tried the same code:

    function a13_minfy( $opts ){
    	$opts = array_merge( $opts, array( 'disable_if_wp_debug' => false ) );
    	return $opts;
    }
    add_filter( 'dependency_minification_options', 'a13_minfy' );

    And this worked as expected in the latest version of the plugin (0.9.6): the scripts and styles got minified even with WP_DEBUG turned on. Is this still an issue?

    Note that your var_dump needs to be after the array_merge to see the effect it has on the options.

    Thread Starter Air.

    (@air-1)

    Note that your var_dump needs to be after the array_merge to see the effect it has on the options.

    Yes I know that, I added it only to see if filter is even called.

    Anyway I have tested it with version 0.9.7 and still no luck. I wonder what it could be. That is very mysterious to me.

    If you are interested, I will give you access so you could see what is so special in my installation that I can’t make it work.

    By the way, if filter is added should this message still appear in plugin settings?

    Dependency Minification is disabled. Any minified dependencies below are cached. To minify new dependencies, disable WP_DEBUG or filter disable_if_wp_debug to be false.

    With regards.

    Plugin Contributor Chris Olbekson

    (@c3mdigital)

    Hi Air,

    Just following up to see if this is still an issue for you. I just tested filtering the disable_if_wp_debug and when it is set to false the notification will not be displayed. When the notification is displayed the files are still being minified and shown on the admin page but they will not be added on the front end.

    add_filter( 'dependency_minification_options', function( $options ) {
    	  $options['disable_if_wp_debug'] = false;
    	  return ( $options );
      });
    Thread Starter Air.

    (@air-1)

    Hello

    I have just tested your code on WP 3.8.1 with plugin in version 0.9.8
    Still I see notice, and it still doesn’t show any new minifcations while debug mode is ON.

    It is very strange as I test it on fresh Twenty Fourteen theme.
    I would hunt it down why is it so, but I have more important things to do so we just have to just ignore it.

    Strange that I am only one that is facing this issue also http://wordpress.org/support/topic/not-working-rewrite-of-url-in-css-2?replies=7

    For me it is somehow connected:-)

    With regards.

    I believe I had this same issue.

    When WP_DEBUG = true, new minified dependencies are not generated. I’ve tried expiring and purging all dependencies, but it doesn’t have any effect.

    More annoyingly, under normal operation, *new* dependencies are not generated either. What I mean is that even if I purge or expire dependencies, in order to force them to be rebuilt due to an updated CSS file or similar, and they are regenerated, the regenerated version contains old versions of the files, even when those files no longer exist on the host filesystem.

    I just purged all dependencies and reinstalled the plugin (which I had to do twice because the plugin didn’t clean up after itself on removal; you should really clear out the stored dependencies when a user removes the plugin, or have an option for it), and it appears to have worked. I will report back if issues similar to this persist.

    I confirm this issue recurs after reinstalling plugin. The only difference is that now the outdated version of files being served is the version that was current when the dependencies were first generated after reinstalling the plugin.

    I have checked the wp_options table and no rows exist when dependencies have been purged. I have no idea where these values might be cached, but they are certainly being cached.

    I have tested with all other plugins disabled, to no effect.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to run filter to make plugin work with WP_DEBUG set to true?’ is closed to new replies.