reduxframework / redux-framework

Redux is a simple, truly extensible options framework for WordPress themes and plugins!

Home Page:http://redux.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Global Opts "tjp_opts" is not loaded during CRON

ak-singla opened this issue · comments

It seems to me that the Global Options Variable is not being loaded during the CRON job. I have tested that it works during the ajax, but not during the CRON job.

I am getting the option field names array, but with blank values, see below:
Slack Ran: ID: VI-1136 Current: Opts: Array ( [tjp_license_key] => [journal-logo] => [editor-journal-logo] => [ebm-journal-footer] => [ebm-letter-watermark] => [letter-signature] => ..... ..... ..... )

Running same function with Ajax it gives this:
Opts: Array ( [last_tab] => [tjp_license_key] => [journal-logo] => Array( [url] => https:\/\/www.MYDOMAIN.com\/wp-content\/uploads\/2017\/02\/logo.png [id] => 5878 [height] => 295 [width] => 1170 [thumbnail] => https:\/\/www.MYDOMAIN.com\/wp-content\/uploads\/2017\/02\/cropped-logo.png ) .... .... .... )

The most recent change was to remove the Redux framework from the plugin's folder and use it as a plugin, with the latest Redux version on the Github.

Please suggest what needs adjusting, as availability of the options at during CRON is important for our website's process.

No, it does not load. That is by design because there were issues in which ajax based saving was failing. Added in v4.2: New global arg load_on_cron. Set to true if you require Redux to run within a cron initiated function.

Thank you for the quick response, it resolved the issue.

Can you tell me more about it or can I read it in detail somewhere?
That is by design because there were issues in which ajax based saving was failing

I barely remember the issue anymore. It might still be among the closed ones. The wp-cron is tied to the heartbeat API, and Redux has to dump out of running every time the heartbeat fired, which interfered with cron, and the auto-save didn't fire. The new global argument basically solves that on an in-demand basis instead of every Redux user. It solved a performance issue we had many years back. The alternative was to use an action hook on the heartbeat API. The global arg seemed cleaner. The cases where this is an issue are exceedingly rare. But, we try to make everyone happy. :)