Michael Stuart
Forum Replies Created
Viewing 3 replies - 1 through 3 (of 3 total)
-
ANOTHER PLUGIN INTERFERED WITH CONTENTGEMS
We found code from another plugin broke the paging in the contentviews plugin, and how how to fix it below:
THE PROBLEM CODE
function redirect_non_logged_in_users() {
??? if (is_admin() && !is_user_logged_in()) {
??????? wp_redirect(home_url('/login'));
??????? exit;
??? }
}
add_action('init', 'redirect_non_logged_in_users');
THE SOLUTION
function redirect_non_logged_in_users() {
?// Exclude front-end requests for the ContentViews plugin
??? if (!is_user_logged_in() && isset($_GET['vcv-pagination'])) {
??????? return; // Allow the pagination to work without interference
??? }
??? // Allow AJAX requests and redirect non-logged-in users from admin area
??? if (is_admin() && !is_user_logged_in() && !wp_doing_ajax()) {
??????? wp_redirect(home_url('/login'));
??????? exit;
??? }
}
add_action('init', 'redirect_non_logged_in_users');It has the same bug; the next page shows a mostly blank screen ?
Here’s some information from the browser (F12)
news/:1 Uncaught (in promise) SyntaxError: “[object Object]” is not valid JSON
at JSON.parse (<anonymous>)
at l._storageChangeDispatcher (content.js:2:898238)
at _storageChangeDispatcherCallback (content.js:2:897686)
How to fix:
- Correctly stringify the object:
- Use?JSON.stringify():?If you have a JavaScript object, use the?JSON.stringify()?method to convert it into a valid JSON string before parsing it.?
Forum: Plugins
In reply to: [PressForward] Stop RSS Feeds from unpublishingThat works,
Thanks
Viewing 3 replies - 1 through 3 (of 3 total)