admin管理员组

文章数量:1391934

Closed. This question is off-topic. It is not currently accepting answers.

Closed 5 years ago.

  • Questions that are too localized (such as syntax errors, code with restricted access, hacked sites, hosting or support issues) are not in scope. See how do I ask a good question?
  • Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Improve this question

The footer widget disappear on their own after few days even if the website is untouched. This happened 4-5 times before and I don't see any security audit log of widget events nor any malware infected. What could be the cause?

There is no solution from the premium theme developers as they have given the common "Added to bug list" reply.

Normal footer:

Footer widgets disappeared:

I have a Development Site for the issue to be checked.

The least security check:

Adding the code which was added for additional footer columns instead of Theme's default 4.

<?php

add_action( 'wp_enqueue_scripts', 'stockie_child_local_enqueue_parent_styles' );

function stockie_child_local_enqueue_parent_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}

// Add Footer Columns 5 and 6

function add_additional_footer() {

register_sidebar( array(
    'name' => esc_html__( 'Footer column 5', 'stockie' ),
    'id' => 'stockie-sidebar-footer-5',
    'before_title' => '<h3 class="title widget-title">',
    'after_title' => '</h3>',
));

register_sidebar( array(
    'name' => esc_html__( 'Footer column 6', 'stockie' ),
    'id' => 'stockie-sidebar-footer-6',
    'before_title' => '<h3 class="title widget-title">',
    'after_title' => '</h3>',
));
}

add_action( 'widgets_init',  'add_additional_footer');
Closed. This question is off-topic. It is not currently accepting answers.

Closed 5 years ago.

  • Questions that are too localized (such as syntax errors, code with restricted access, hacked sites, hosting or support issues) are not in scope. See how do I ask a good question?
  • Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Improve this question

The footer widget disappear on their own after few days even if the website is untouched. This happened 4-5 times before and I don't see any security audit log of widget events nor any malware infected. What could be the cause?

There is no solution from the premium theme developers as they have given the common "Added to bug list" reply.

Normal footer:

Footer widgets disappeared:

I have a Development Site for the issue to be checked.

The least security check:

Adding the code which was added for additional footer columns instead of Theme's default 4.

<?php

add_action( 'wp_enqueue_scripts', 'stockie_child_local_enqueue_parent_styles' );

function stockie_child_local_enqueue_parent_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}

// Add Footer Columns 5 and 6

function add_additional_footer() {

register_sidebar( array(
    'name' => esc_html__( 'Footer column 5', 'stockie' ),
    'id' => 'stockie-sidebar-footer-5',
    'before_title' => '<h3 class="title widget-title">',
    'after_title' => '</h3>',
));

register_sidebar( array(
    'name' => esc_html__( 'Footer column 6', 'stockie' ),
    'id' => 'stockie-sidebar-footer-6',
    'before_title' => '<h3 class="title widget-title">',
    'after_title' => '</h3>',
));
}

add_action( 'widgets_init',  'add_additional_footer');
Share Improve this question edited Feb 15, 2020 at 9:32 m4n0 asked Feb 6, 2020 at 8:46 m4n0m4n0 1,36410 silver badges22 bronze badges 9
  • "Added to bug list" sounds like the theme developers believe that what you are reporting is a bug in their implementation – bosco Commented Feb 8, 2020 at 22:17
  • Yes but it could be a general cooling comment as they deal with many such tickets and try to move on. I have received that response in other tickets as well, which could have been solved by them. – m4n0 Commented Feb 9, 2020 at 8:51
  • No one can tell anything without looking inside. Look at the "widgets_init" functions, also look at the templates where the widgets are added. There might might be some "if" functions. – Bikram Commented Feb 9, 2020 at 10:08
  • 2 @ManojKumar It could be possible to lose widgets because of a PHP error that prevents them to be loaded. My suggestion is enabling debug log and check it after seeing the issue again. – Hector Commented Feb 9, 2020 at 11:24
  • 3 This question is impossible to address without inclusion of the code that is causing the trouble. – cjbj Commented Feb 9, 2020 at 11:33
 |  Show 4 more comments

1 Answer 1

Reset to default 1

Look at the "widgets_init" functions in your theme. There might be other conditions registered for the widgets.

If the widgets are registered correctly with no other conditions. Next, the best place would be at the template.

Look at the template where the widgets are added. There might be some "if" functions that might be controlling the appearance of widgets.

By the look of your development site, the widgets seem to appear inside a template. Find the template where widgets are added. There is a higher chance the widgets are might be on sidebar-name.php or on the footer.php or any other. Look at both the child theme and the parent theme. If the child theme is the cause, alter the codes to your need. If the parent theme is the cause, create an exact same copy of the file at the child theme and edit the codes to your need.

本文标签: Random disappearance of footer widgets