Skip to content

Instantly share code, notes, and snippets.

@webaware
Created December 31, 2018 06:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webaware/3cfe46a4da612ce1f57526e1ec8cabb2 to your computer and use it in GitHub Desktop.
Save webaware/3cfe46a4da612ce1f57526e1ec8cabb2 to your computer and use it in GitHub Desktop.
code excerpt for restoring the FAQ section to responses in EDD Software Licensing API calls
<?php
//...
add_filter('edd_sl_license_readme_response', array($this, 'eddMaybeRestoreFAQ'), 10, 3);
/**
* maybe restore the FAQ section to the update info package
* @param array $response
* @param \EDD_SL_Download $download
* @param array $readme
* @return array
*/
public function eddMaybeRestoreFAQ($response, $download, $readme) {
$sections = unserialize($response['sections']);
if (empty($sections['faq']) && (!empty($readme['sections']['faq']))) {
$sections['faq'] = $readme['sections']['faq'];
$response['sections'] = serialize($sections);
}
return $response;
}
//...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment