0

When I changed the Theme to Twenty Seventeen a few of the pages had the following text instead of the Header image:

Notice: Only variables should be assigned by reference in /var/www/wp-content/plugins/exclude-pages/exclude_pages.php on line 92 class="page-template-default page page-id-835 page-parent logged-in admin-bar no-customize-support wp-embed-responsive ecwd-theme-twentyseventeen has-header-image page-two-column colors-light">

I have not been able to resolve his.

2
  • 2
    this looks like an issue with the exclude-pages plugin, have you contacted their support and made sure the plugin is up to date?
    – Tom J Nowell
    Jan 23 at 17:16
  • 1
    it looks like this was written by Simon Wheatley but it's abandoned and hasn't been touched in 12 years: wordpress.org/plugins/exclude-pages you should deactivate it and find an alternative
    – Tom J Nowell
    Jan 23 at 17:18

1 Answer 1

0

The error message you're encountering in WordPress suggests a notice-level issue in the code, specifically in the exclude_pages.php file of the 'Exclude Pages' plugin. This issue seems to be related to PHP's handling of variables and references. Here's how you can address it:

Understand the Error: The notice is indicating that a variable is being assigned by reference in an improper manner. This often happens when using the =& operator in PHP, which is used to assign a reference to a variable.

Check Your PHP Version: Different PHP versions may handle references differently. Make sure your server is using a PHP version that is compatible with both WordPress and your plugins. A more recent PHP version could be stricter about reference assignments.

Edit the Plugin File:

Backup: First, make a backup of the exclude_pages.php file. Edit: Open /var/www/wp-content/plugins/exclude-pages/exclude_pages.php. Find Line 92: Look for the code at line 92. Update the Code: The exact change depends on the code. If it’s something like $variable =& some_function();, you can usually safely change it to $variable = some_function();. This removes the reference assignment.

Alternative Solutions:

Update the Plugin: Ensure the 'Exclude Pages' plugin is updated to its latest version. Plugin updates often fix such compatibility issues. Check for Plugin Conflicts: Deactivate other plugins temporarily to see if the issue persists. Sometimes, conflicts between plugins can cause unexpected errors. Switch to a Different Plugin: If the 'Exclude Pages' plugin is outdated or not maintained, consider using an alternative plugin that offers similar functionality.

Testing and Debugging:

After making changes, test your website thoroughly to ensure that everything is functioning correctly. You can enable WordPress debugging by adding define('WP_DEBUG', true); in your wp-config.php file to see if any other issues arise. Remember to turn this off on a live site after debugging. Contact Plugin Support: If you're uncomfortable editing plugin files or if the issue persists, it’s advisable to contact the plugin’s support for a resolution.

Remember, directly editing plugin files is generally not recommended because your changes will be overwritten when the plugin is updated. In such cases, contacting the plugin developer for a fix is the best course of action.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.