Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Ensure that widget actions and filters get added for previewing snapshots for unauthenticated users #33

Closed
westonruter opened this issue Jun 6, 2016 · 3 comments
Milestone

Comments

@westonruter
Copy link
Contributor

westonruter commented Jun 6, 2016

The constructor for WP_Customize_Widgets has this bit of code before it does the add_action() and add_filter() calls:

// Skip useless hooks when the user can't manage widgets anyway.
if ( ! current_user_can( 'edit_theme_options' ) ) {
    return;
}

This will cause a problem for previewing widgets on the frontend for unauthenticated users because these filters/actions aren't getting added: https://github.com/xwp/wordpress-develop/blob/885d38edc8de04c3cf7baced5ef0effc8c5a6bd6/src/wp-includes/class-wp-customize-widgets.php#L101-L120

Snapshots should be adding these filters and actions (as required) if ! has_filter() or ! has_action().

@westonruter
Copy link
Contributor Author

I haven't actually verified that this is actually an issue, but I can't see how it wouldn't be an issue 😄

@valendesigns
Copy link
Contributor

@westonruter Well, it seems the issue is now much bigger than it was. I cannot see any new widgets in the Snapshot, regardless of if I'm authenticated or not. Even if I comment out that return.

@valendesigns
Copy link
Contributor

@westonruter It appears to be an issue with the widget value not being set when saving the Snapshot for new widgets. I'm trying to hunt down the root issue, but if you have any suggestions that would be great. Perhaps there was a change in the widgets API that is causing this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants