Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

WP error when migrating from one hosting server to another WordPress


I have this website in Japanese, which has been hosted by IIJ America. I was trying to move this WP site to godady hosting server and the following
error message came up when changing the DNS server.

?Error message?
Warning: Missing argument 1 for post_is_in_descendant_category(), called in /home/content/98/7370698/html/us-internship/wp-content/themes/us-internship-new/sidebar.php on line 36 and defined in /home/content/98/7370698/html/us-internship/wp-includes/functions.php on line 3653

line 36 of sidebar.php is the following:
<?php if ( is_category() || post_is_in_descendant_category()) { ?>

line 3653 of function.php is the following:
function post_is_in_descendant_category( $cats, $_post = null )

I would appreciate if you can help solving this problem.

Thank you!

Answers (2)


Arnav Joy answers:

can you show me your functions.php

Arnav Joy comments:

see following

line 36 of sidebar.php is the following:
<?php if ( is_category() || post_is_in_descendant_category()) { ?>

and replace it with

line 36 of sidebar.php is the following:
<?php if ( is_category() || post_is_in_descendant_category(get_query_var('cat'))) { ?>

and then see if error goes.

Arnav Joy comments:

share your sidebar.php please

Arnav Joy comments:

If you'd rather refer to the category by name you can use,

$category_to_check = get_term_by( 'name', 'fruit', 'category' );

<?php if ( is_category() || post_is_in_descendant_category($category_to_check->term_id)) { ?>

kensama0814 comments:

Thank you. here is the sidebar.php
<div id="side">

<?php // If is category or subcategory of $cat_id
if (!function_exists('is_category_or_sub')) {
function is_category_or_sub($cat_id = 0) {
foreach (get_the_category() as $cat) {
if ($cat_id == $cat->cat_ID || cat_is_ancestor_of($cat_id, $cat)) return true;
return false;
} ?>
<?php if ( is_home()) { //???????>

<?php } elseif ( is_category('internship') || post_is_in_descendant_category(32)) { //????????>
<h3 id="side_nav_head01">???????</h3>
<?php } elseif ( is_category('visa') || post_is_in_descendant_category(35)) { //?????????>
<h3 id="side_nav_head02">????????</h3>
<?php } elseif ( is_category('testimonial') || post_is_in_descendant_category(30)) { //????>
<h3 id="side_nav_head03">???</h3>
<?php } elseif ( is_category('information') || post_is_in_descendant_category()) { //?????>
<h3 id="side_nav_head04">????</h3>
<?php } elseif ( is_category('link') || post_is_in_descendant_category(36)) { //??????&????>
<h3 id="side_nav_head05">??????&amp;???</h3>
<?php } elseif ( is_category('company') || post_is_in_descendant_category(31)) { //?????????>
<h3 id="side_nav_head06">????????</h3>
<?php } elseif ( is_category(33) || post_is_in_descendant_category(33)) { //????????????>
<h3 id="side_nav_head08">???????????</h3>
<?php } elseif ( is_category(34) || post_is_in_descendant_category(34)) { //????????????>
<h3 id="side_nav_head09">To US Employers</h3>
<?php } elseif ( is_category(60) || post_is_in_descendant_category(60)) { //???????????>
<h3 id="side_nav_head10">Internship</h3>
<?php } elseif ( is_category(79) || post_is_in_descendant_category(79)) { //OPT?????>
<h3 id="side_nav_head11">OPT????</h3>
<?php } ?>

<?php if ( is_category() || post_is_in_descendant_category()) { ?>
<div class="sub_block">
if (is_category()) {
$this_category = get_category($cat);
$this_category = wp_list_categories('orderby=order&title_li=&child_of='.$this_category->category_parent."&echo=0"); else
$this_category = wp_list_categories('orderby=order&title_li=&child_of='.$this_category->cat_ID."&echo=0");
if ($this_category) { ?>
<?php echo $this_category; ?>
<div class="side_footer">&nbsp;</div>

elseif (is_home()) { //?????? ?>

<?php } else {// If no current cat query, just get the top level ones using wp_list_categories. ?>
<?php wp_list_categories('orderby=order&title_li=&depth=1');?>
<div class="side_footer">&nbsp;</div>
<?php } ?>

<div id="enterprise_block">
<div align="center"><a href="/?cat=61" title="???? ????????????">
<img src="/wp-content/themes/us-internship-new/images/GlovalExchange-Banner-2.jpg" alt="" border="0" />

<p>??????????????????!<br />
<div id="form_btn03"><a href="<?php echo get_option('home'); ?>/?page_id=50">????????</a></div>
<div class="detail"><a href="<?php echo get_option('home'); ?>/?cat=33">??????</a></div>
<div class="side_footer">&nbsp;</div>
<div id="form_block">
<div id="form_btn01"><a href="<?php echo get_option('home'); ?>/?page_id=48">????????</a></div>
<div id="form_btn02"><a href="<?php echo get_option('home'); ?>/?page_id=52">?????????</a></div>
<div class="side_footer">&nbsp;</div>
<div id="mail_block">
<?php wpsb_opt_in(); ?>
<div class="side_footer"></div>
<div id="english"><a href="<?php echo get_option('home'); ?>/?cat=34">English pages for US Employers</a></div>

<div style="margin: 5px 0; text-align: center;">
<a href="" target="_blank">
<img src="<?php bloginfo('stylesheet_directory'); ?>/images/fb_banner.png" alt="?????????????????????????????" border="0" />

kensama0814 comments:

??? is in Japanese language..

kensama0814 comments:

I tried replacing with this:
<?php if ( is_category() || post_is_in_descendant_category(get_query_var('cat'))) { ?>

but error still remains..

Arnav Joy comments:

you have two places there where you have called this function


see other places where you have called this function with a no. passed to it as




so this 35 or 36 is id of the category , so you have to do same thing for the blank function


for example


only then it will remove error

kensama0814 comments:

error now became the following:

Warning: Missing argument 1 for post_is_in_descendant_category(), called in /home/content/98/7370698/html/us-internship/wp-content/themes/us-internship-new/sidebar.php on line 20 and defined in /home/content/98/7370698/html/us-internship/wp-includes/functions.php on line 3653

it is now line 20 instead of line 36..

Arnav Joy comments:

this is because you have one more function call at line no. 20

<?php } elseif ( is_category('information') || post_is_in_descendant_category()) { //?????>

so you also have to place any no. (id of the category ) to the function as

<?php } elseif ( is_category('information') || post_is_in_descendant_category(9999)) { //?????>

kensama0814 comments:

Thank you.
I see oneplace without a no.

I'm sorry but can you tell me how to find the right number to fill in?

kensama0814 comments:

I found out the number to fill in. and it looks it's working now!
Thank you so much!


John Cotton answers:

post_is_in_descendant_category is expecting at least one parameter - $category defined in the codex as follows:

<blockquote>(mixed) (required) One or more categories specified by ID (integer), name or slug (string), or an array of these</blockquote>

So you need to pass something...