Tag Archives: PHP and Wordpress

FATAL ERROR MEMORY ISSUES WordPress

Ok So I needed to install a new version of wordpress (v2.9) for my site because I wanted to make sure that I my plugin would work right with new wordpress. So I auto install from my host (BTW wicked COOL, couldn’t do that before on my previous site), it does its thing and then says done. I go to check my set to see the new stuff and get this error:
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 4864 bytes) in /home4/thomasno/public_html/wp-includes/default-widgets.php on line 613

I had no idea what to do and then I thought maybe a couple of searches through WordPress and Google and maybe I could get somewhere.

I then found this little GEM that fixed everything:

1
ini_set('memory_limit','64M');

You put this in your wp_config.php file at the top right above:


GD Star Rating
loading...
GD Star Rating
loading...

wp_get_archives(‘type=alpha’)

Thanks to a great find. I was able to make some sweet adjustments to my site. With some modification to what JTK said on his website I used some really cool drop down boxes to achieve what I wanted on my site. I will give you the code for both.

First I wanted to make all my posts accessible on any post page. Then after I found that I could do that I found out how to make it not so obtrusive. Because if you have a lot of posts and not a lot of space on your page you don’t necessarily want the first option that JTK had.

So I found a different way and possibly a better one. If you look on my single post page you can see the top, right below adsense (two drop boxes), one with posts most recent and the other with posts alphabetized.

Anyway without further ado, THE CODE:

1
2
3
4
5
6
7
8
9
<select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> 
  <option value=""><?php echo attribute_escape(__('Pick a new post to go to! (Most recent to oldest)')); ?></option> 
  <?php wp_get_archives('type=postbypost&format=option&show_post_count=1'); ?> </select><br />
<select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'>
  <option value="">
   <?php echo attribute_escape(__('Pick a new post to go to! (Alphabetically A-Z)')); ?>
   </option>
  <?php wp_get_archives('type=alpha&format=option&show_post_count=1'); ?>
</select>
GD Star Rating
loading...
GD Star Rating
loading...