Pay money and get answers for your WordPress questions (more info)

WP error when migrating from one hosting server to another

  • SOLVED

I have this website in Japanese, www.us-internship.com 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)

2013-01-31

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">
<?php
if (is_category()) {
$this_category = get_category($cat);
}
if($this_category->category_parent)
$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) { ?>
<ul>
<?php echo $this_category; ?>
</ul>
<div class="side_footer">&nbsp;</div>
<?php

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

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



<h3>????????????</h3>
<p>??????????????????!<br />
????????????????????</p>
<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>
<div id="form_block">
<h3>????????</h3>
<p>??????????????????????????!
???????????????????!</p>
<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>
<div id="mail_block">
<h3>???????</h3>
<p>?????????????????????????????!</p>
<?php wpsb_opt_in(); ?>
<div class="side_footer"></div>
</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="http://www.facebook.com/syukatsuusa" target="_blank">
<img src="<?php bloginfo('stylesheet_directory'); ?>/images/fb_banner.png" alt="?????????????????????????????" border="0" />
</a>
</div>
</div>


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

post_is_in_descendant_category()

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

post_is_in_descendant_category(35)

or

post_is_in_descendant_category(36)

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

post_is_in_descendant_category()

for example

post_is_in_descendant_category(33)etc..

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!

2013-01-31

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...