Allow users to manage some options without granting ‘manage_options’ capability
Allow users to manage some options without granting ‘manage_options’ capability
Allow users to manage some options without granting ‘manage_options’ capability
Solved by using Content-Type: application/x-www-form-urlencode with new URLSearchParams(body).toString() instead of JSON.stringify(body). autosave-checklist.js details.addEventListener(‘change’, () => { fetch(autosaveChecklist.ajaxUrl + ‘?action=autosave_checklist’, { method: ‘POST’, body: new URLSearchParams({ action : ‘autosave_checklist’, option: ‘details-checkbox’, item: details.checked }).toString(), headers: { ‘Content-Type’: ‘application/x-www-form-urlencoded’, }, }) .then(res => console.log(res)) .catch(err => console.error(err));; }); socials.addEventListener(‘change’, () => { fetch(autosaveChecklist.ajaxUrl, { method: ‘POST’, body: … Read more
Plugin forms overwrite each other’s options
update_option with array_push adding mutiple copies
WordPress plugin options page not saving options, no errors
Use Ajax to get an Options Settings Value
Because you’re registering your hook inside the function that is rendering the form. When the form is submitted, the update_option action has already run before it gets to displaying the form. Move it outside the function. As it appears you’re using a class, adding the action to the __construct method might be a good idea.
Never. The only exception is if none of the WP tables structure in terms of indexing meets your needs, but that is very very rare.
I am having a hard time understanding exactly what the problem is but two things come to mind. locate_template searches theme directories. It is not a general purpose file loader. I don’t know if that is relevant to your case. There is not enough detail in the question to work that out. Given that you … Read more
The Codex suggests that you use wp_load_alloptions instead. I would suggest that you therefore use wp_load_alloptions. That technically answers the question, I think. wp_load_alloptions will pull all of the options out of the options table and your question does not explain why you need to do that. Are you actually needing to pull only your … Read more