-1

While installing a plugin I had the following error: "The plugin does not have a valid header."

But somehow, it worked. So after that, I created a page on which I added the short code suggested by the plugin help. When I clicked on update page, it returned the following error:

Warning: Cannot modify header information - headers already sent by (output started at /var/sites/j/jamworld876.net/public_html/wp-content/plugins/wp-custom-fields-search/templates/preset-display.php:1) in /var/sites/j/jamworld876.net/public_html/wp-admin/post.php on line 198

Warning: Cannot modify header information - headers already sent by (output started at /var/sites/j/jamworld876.net/public_html/wp-content/plugins/wp-custom-fields-search/templates/preset-display.php:1) in /var/sites/j/jamworld876.net/public_html/wp-includes/pluggable.php on line 1216

The preset-display.php page that seems to be litigious contains:

<div class='wpcfs-search-preset wpcfs-search-preset-<?php echo $id?>'>
<?php
        WPCFSSearchForm::show_form($preset,"preset-$id");
?>
</div>

Except that, the plugin seemed to be working fine. I logged out. Everything was working fine on the front end. This is the page where I added the shortcode: http://www.jamworld876.net/advanced-search

But since I enabled this plugin, I'm unable to login. When I visit the login screen, the page is blank.

I suppose this php issue is the root of my problem. Though, I really need this plugin and I haven't found another one that does what I need but I cannot log in my backend no more.

Could someone help me fix this issue please? I really don't know ho to proceed to fix this.

1 Answer 1

1

Well, the error says exactly what's going on.

You're outputting content, before the data is finished being manipulated. It's like you're trying to echo something but WordPress still has to do some stuff and it's telling you "No, no, let me do my thing first". You're calling the echo too early.

In short, you're 99% outputting before wp_head.

So, go to header.php and after the body div, put your

WPCFSSearchForm::show_form($preset,"preset-$id");

Or

require_once preset-display.php

Should work.

Thing is, this is really bad to do, so I suggest hooking show_form to an action and outputting it anywhere you want.

1
  • The issue is caused by the plugin Yoast SEO. If deactivated it, it works fine. So I'm trying to fix it without uninstalling Yoast SEO.
    – esmitex
    Commented Jun 9, 2018 at 18:02

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.