I got HTTP ERROR 500 when I tried to get all the posts from a hierarchical taxonomy which is category.
I have a page and in this page I want to display all the posts. This page and those posts have same category which called ex. hello.
In the page I used this query below to output the posts from the category which this page have.
<div class="box">
<?php
$category = get_the_category();
if($category->category_parent > 0){
echo $category[0]->cat_name;
}
$args = array(
'post_type' => 'post',
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => array( $category[0]->cat_name ),
),
array(
'taxonomy' => 'post_format',
'field' => 'slug',
'terms' => array( 'post-format-video' ),
),
),
'order' => 'ASC',
'nopaging' => true,
);
$the_query = new WP_Query( $args );
while ( $the_query->have_posts() ) {
$the_query->the_post();?>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><h3><?php the_title(); ?></h3></a>
<?php }
// Restore original Post Data
wp_reset_postdata();
?>
</div>
The query worked fine with the other categories in the other pages which have maximum 300 posts. But category hello have more than 900 posts and when I display theme with the same query I got HTTP ERROR 500.
The category hello is a child of a category called series but this is not the reason of this problem but I wanted just to clarify the issue for you.
Note: When the category hello had 500 posts the page worked and the posts are displaying but the page take more than 3 seconds to load. So the more posts I add to the category the more time the page need to load and in the end if the posts became more the page give me HTTP ERROR 500.
Note: I tried the code on loaclhost and everything worked no errors at all.
Update: I have added this code to wp-config
@ini_set( 'upload_max_filesize' , '99999M' );
@ini_set( 'post_max_size', '99999M');
@ini_set( 'memory_limit', '999999M' );
@ini_set( 'max_execution_time', '300000' );
@ini_set( 'max_input_time', '300000' );
and this code to .htaccess
php_value upload_max_filesize 99999M
php_value post_max_size 99999M
php_value memory_limit 999999M
php_value max_execution_time 300000
php_value max_input_time 300000
I have added these codes above to increase the memory, execution size and upload file size etc.
After I have added them I got 503 ERROR instead of 500 ERROR
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745245900a4618408.html
评论列表(0条)