Support » Plugin: Simple Custom CSS and JS » 500 error when enabling/disabling plugin on WPML sites

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Diana Burduja

    (@diana_burduja)

    Hello Kristof,

    the Simple Custom CSS and JS plugin calls the flush_rewrite_rules() function once when the the Simple Custom CSS and JS plugin is activated (not when other plugins get activated, also not when any of the plugins get deactivated) and once when the “Add the Web Designer role” option on the “WP Admin -> Custom CSS & JS -> Settings” page changes.

    You can test the fact that the flush_rewrite_rules() function is called indeed only in these two cases by adding the following line:

    echo "flush_rewrite_rules function was called"; die();

    in the flush_rewrite_rules function (on line 280 in /wp-includes/rewrite.php file for WP5.8) and browse the website on frontend and backend. The Simple Custom CSS and JS plugin will stumble upon this debug message only when getting activated and when the “Add the Web Designer role” option changes in the backend.

    I also don’t seem to be able to replicate the 500 error on my test website. See this screencast. Do I need to register the WPML plugin in order to get the 500 error. Or do I need to change the permalinks sometime during the test?

    Thread Starter puregraphx

    (@puregraphx)

    Hi,

    I don’t think you need to activate WPML.
    I have made a screencast where I reproduced the issue twice.
    https://screencast-o-matic.com/watch/crj1IeVj6Dz

    Plugin Author Diana Burduja

    (@diana_burduja)

    Ok, it was not clear that the 500 error shows up after activating the Simple Custom CSS and JS plugin. I thought that the error shows up after activating the WPML plugin.

    But it’s still unclear what should I do in the Simple Custom CSS and JS plugin in order to avoid the 500 error. The plugin doesn’t call the flush_rewrite_rules function on every page or “too often”, as described in the .htaccess is rewritten with language folder article. It does that only during activation and during an option change. Does that mean that no plugin can call the flush_rewrite_rules function at all if the WPML plugin is installed? Is there any suggestion on what should I use instead in the Simple Custom CSS and JS plugin?

    • This reply was modified 5 months, 3 weeks ago by Diana Burduja.
    Plugin Author Diana Burduja

    (@diana_burduja)

    Here is a quote from the Developer Resources register_post_type function about how should to a plugin register a post type:

    Note: If registering a post type inside of a plugin, call flush_rewrite_rules() in your activation and deactivation hook (see Flushing Rewrite on Activation below). If flush_rewrite_rules() is not used, then you will have to manually go to Settings > Permalinks and refresh your permalink structure before your custom post type will show the correct structure.

    The Simple Custom CSS and JS plugin does exactly as recommended in the WordPress documentation: it calls the flush_rewrite_rules function in the activation hook. Any improvement suggestion from the WPML support team would be helpful.

    • This reply was modified 5 months, 3 weeks ago by Diana Burduja.
    Thread Starter puregraphx

    (@puregraphx)

    Hi,

    Thanks again for taking the time to look into this issue. I would be happy to transfer your feedback to the WPML devs, but in this case I am afraid I might be kind of the middle man who slows this down.

    WPML has advised me that if you would need their suggestions/feedback/help, they have a specific Go Global Program where they assist developers in making their plugins/themes WPML compatible.
    You can find it at https://wpml.org/documentation/support/go-global-program/
    If your plugin would receive the WPML compatibility badge, it could increase your number of installs/purchases.

    If not, then I will happily post your feedback in a new WPML ticket and report their answer, but it might take more of each of our time, so the compatibility program might be more time and resource efficient.

    Plugin Author Diana Burduja

    (@diana_burduja)

    The Simple Custom CSS and JS plugin doesn’t need to be multilingual-ready and the Go Global Program only would only give me some guides about how to make the plugin multilingual-ready and access to a sandbox site for testing.

    Would you please link this discussion in the https://wpml.org/forums/topic/500-error-when-enabling-disabling-plugin/ forum? A member of the WPML support team is welcome to continue the discussion here.

    Thread Starter puregraphx

    (@puregraphx)

    I have invited a WPML support member to continue the discussion here, but they are not inclined to, they stick to their Go Global Program “Yes, what the developer mentioned is correct. But the go global program also gives access to pass the info to our compatibility developers directly.”

    I can only kindly ask you once again to consider posting your feedback via that channel. If not, we will continue to use their workaround. I understand your time is precious, so no hard feelings.

    Have a nice day.

    Plugin Author Diana Burduja

    (@diana_burduja)

    From my point of view the Simple Custom CSS and JS plugin calls correctly the flush_rewrite_rules() function, as per Developer Resources documentation.

    Obviously there is a bug in the WPML plugin. Fixing it would make the WPML plugin compatible with all the other plugins that legitimately call the flush_rewrite_rules() function only once in the activation hook.

    Would you please link this discussion in the https://wpml.org/forums/topic/500-error-when-enabling-disabling-plugin/ forum? It would be time for them to show a bit of flexibility and maybe review their bug in the light of a legitimate use of the flush_rewrite_rules() function in the activation hook.

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.