Title: Error using Php code in post
Last modified: August 19, 2016

---

# Error using Php code in post

 *  [cje](https://wordpress.org/support/users/cje/)
 * (@cje)
 * [17 years ago](https://wordpress.org/support/topic/error-using-php-code-in-post/)
 * I’ve activated the php-execution-plugin
    I my post I’ve used the bellow code 
   to display a random post, from my category “category | test”, in a static page,
   on the front page but it returns a fatal error
 * Fatal error: Allowed memory size of 52428800 bytes exhausted (tried to allocate
   35 bytes) in /var/www/testserver/test/wp-includes/plugin.php on line 385
 * <?php
    $rand_posts = get_posts(‘numberposts=1&offset=1& category_name=category
   | test&orderby=rand’); foreach( $rand_posts as $post ) : ?> <div class=”body”
   > <?php the_excerpt(); ?></div> <?php endforeach; ?>
 * Do you know what’s wrong?
    Thanks for any suggestions!

The topic ‘Error using Php code in post’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [cje](https://wordpress.org/support/users/cje/)
 * Last activity: [17 years ago](https://wordpress.org/support/topic/error-using-php-code-in-post/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
