• Resolved Jessica

    (@leadstartorg)


    This is the error I got when I turned on the debugger in wp-config.php:

    Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, no array or string given in /opt/bitnami/wordpress/wp-includes/class-wp-hook.php:308 Stack trace: #0 /opt/bitnami/wordpress/wp-includes/plugin.php(205): WP_Hook->apply_filters() #1 /bitnami/wordpress/wp-content/plugins/contact-form-7/includes/functions.php(216): apply_filters() #2 /bitnami/wordpress/wp-content/plugins/contact-form-7/includes/contact-form.php(851): wpcf7_autop_or_not() #3 /bitnami/wordpress/wp-content/plugins/contact-form-7/includes/contact-form.php(923): WPCF7_ContactForm->replace_all_form_tags() #4 /bitnami/wordpress/wp-content/plugins/contact-form-7/includes/contact-form.php(623): WPCF7_ContactForm->form_elements() #5 /bitnami/wordpress/wp-content/plugins/contact-form-7/includes/contact-form-functions.php(229): WPCF7_ContactForm->form_html() #6 [internal function]: {closure}() #7 /bitnami/wordpress/wp-content/plugins/contact-form-7/includes/l10n.php(147): call_user_func() #8 /bitnami/wordpress/wp-content/plugins/contact-form-7/includes/contact-form-functions.php(233): wpcf7_switch_locale() #9 /opt/bitnami/wordpress/wp-includes/shortcodes.php(355): wpcf7_contact_form_tag_func() #10 [internal function]: do_shortcode_tag() #11 /opt/bitnami/wordpress/wp-includes/shortcodes.php(227): preg_replace_callback() #12 /opt/bitnami/wordpress/wp-includes/class-wp-hook.php(308): do_shortcode() #13 /opt/bitnami/wordpress/wp-includes/plugin.php(205): WP_Hook->apply_filters() #14 /bitnami/wordpress/wp-content/themes/leadstart/template-parts/content-notitle.php(16): apply_filters() #15 /opt/bitnami/wordpress/wp-includes/template.php(785): require(‘…’) #16 /opt/bitnami/wordpress/wp-includes/template.php(718): load_template() #17 /opt/bitnami/wordpress/wp-includes/general-template.php(204): locate_template() #18 /bitnami/wordpress/wp-content/themes/leadstart/blank-page.php(12): get_template_part() #19 /opt/bitnami/wordpress/wp-includes/template-loader.php(106): include(‘…’) #20 /opt/bitnami/wordpress/wp-blog-header.php(19): require_once(‘…’) #21 /opt/bitnami/wordpress/index.php(17): require(‘…’) #22 {main} thrown in /opt/bitnami/wordpress/wp-includes/class-wp-hook.php on line 308

    I tried removing autop so many ways in the past but I had an issue where it caused a fatal error anytime I tried to use the Contact Form 7 plugin. I think there needs to be a fixed in the next release.

    //remove autop from everywhere
    
    remove_filter('widget_text_content', 'wpautop');
    
    remove_filter('the_excerpt', 'wpautop');
    
    remove_filter('the_content', 'wpautop');
    
    remove_filter('widget_text_content', 'wpautop');
    
    remove_filter('the_content', 'wptexturize');
    
    add_filter('widget_text_content', 'leadstart_removing_autop', 999);
    
    add_filter('widget_custom_html_content', 'leadstart_removing_autop', 999);
    
    function removing_autop($content)
    
    {
    
      $content = str_replace(['<p>', '</p>'], ['', ''], $content);
    
      return $content;
    
    }

    I am using PHP version 8.1.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    What did you want to do with this?

    add_filter('widget_text_content', 'leadstart_removing_autop', 999);
    
    add_filter('widget_custom_html_content', 'leadstart_removing_autop', 999);
    Thread Starter Jessica

    (@leadstartorg)

    It removes autop from widgets, you can ignore.

    The error happened when I used your filter hook – sorry I did not post all the code.

    add_filter(‘wpcf7_autop_or_not’, ‘__return_false’);

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    Have you defined the leadstart_removing_autop somewhere else?

    Thread Starter Jessica

    (@leadstartorg)

    No, I was able to fix the issue and use a CF7 shortcode when I removed the autop filters. I just posted here in case anyone else runs across the issue.

    • This reply was modified 3 years, 8 months ago by Jessica.
Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Contact Form 7 White Screen/Fata Error Unknown’ is closed to new replies.