Title: probleme with my plugin &#8211; str_replace
Last modified: August 18, 2016

---

# probleme with my plugin – str_replace

 *  [taghaboy](https://wordpress.org/support/users/taghaboy/)
 * (@taghaboy)
 * [18 years, 7 months ago](https://wordpress.org/support/topic/probleme-with-my-plugin-str_replace/)
 * hi,
    i’m new at WP Coding, i find it cool especailly with the plugin setup, so
   i do creat a plugin who will to easy my need to show my archives, so i creat 
   one who used the php “str_replace”, it work perfectly whene i replace some words,
   but whene i put a template tag it dont her my code : ____________________ <?php/*
   Plugin Name: Archives Plugin URI: [http://agadirweb.com](http://agadirweb.com)
   Description: Display the archives monthly or yearly. Version: 0.1 Author: Hafsi
   Kamal Author URI: [http://agadirweb.com](http://agadirweb.com) */ function monthly_get_archives(){
   print(‘ <?php wp_get_archives(‘type=monthly&limit=12’); ?> ‘); }
 * function my_function ($text) {
    $text = str_replace(‘###archives-monthly###’,
   monthly_get_archives(), $text); return $text; } add_filter(‘the_content’,’my_function’);?
   > ____________________ the word press declare an error in this lines with ***
   print(‘ ***<?php wp_get_archives(‘type=monthly&limit=12’); ?> ‘); } thanks all
   for u r help

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [Lester Chan](https://wordpress.org/support/users/gamerz/)
 * (@gamerz)
 * [18 years, 7 months ago](https://wordpress.org/support/topic/probleme-with-my-plugin-str_replace/#post-642081)
 * because you did not escape the quotes \’
 *  Thread Starter [taghaboy](https://wordpress.org/support/users/taghaboy/)
 * (@taghaboy)
 * [18 years, 7 months ago](https://wordpress.org/support/topic/probleme-with-my-plugin-str_replace/#post-642104)
 * > because you did not escape the quotes \’
 * i do that but not working
 *  [Lester Chan](https://wordpress.org/support/users/gamerz/)
 * (@gamerz)
 * [18 years, 7 months ago](https://wordpress.org/support/topic/probleme-with-my-plugin-str_replace/#post-642129)
 * from what I looked at the code, you cant do that to wp_get_archives() because
   that function print stuffs out and not return you a value. You need to use object
   buffer(ob) to do it, [http://php.net/ob_start](http://php.net/ob_start)
 *  Thread Starter [taghaboy](https://wordpress.org/support/users/taghaboy/)
 * (@taghaboy)
 * [18 years, 7 months ago](https://wordpress.org/support/topic/probleme-with-my-plugin-str_replace/#post-642202)
 * hello,
    really it’s so hard to me to understand all thos codos, i’m not really
   a pro in PHP but i still learning it, if possible pls , can ypu do a touche in
   that code. thanks
 *  [Lester Chan](https://wordpress.org/support/users/gamerz/)
 * (@gamerz)
 * [18 years, 7 months ago](https://wordpress.org/support/topic/probleme-with-my-plugin-str_replace/#post-642214)
 * `ob_start();`
    `wp_get_archives('type=monthly&limit=12');` `$archives = ob_get_contents();``
   ob_end_clean();`
 * Do your stuff on $archives.
 *  Thread Starter [taghaboy](https://wordpress.org/support/users/taghaboy/)
 * (@taghaboy)
 * [18 years, 7 months ago](https://wordpress.org/support/topic/probleme-with-my-plugin-str_replace/#post-642232)
 * Sir,still not understand yet, where i add that code… can u to provide me the 
   complet code please.
    thanks

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘probleme with my plugin – str_replace’ is closed to new replies.

## Tags

 * [archives](https://wordpress.org/support/topic-tag/archives/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [str_replace](https://wordpress.org/support/topic-tag/str_replace/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 6 replies
 * 2 participants
 * Last reply from: [taghaboy](https://wordpress.org/support/users/taghaboy/)
 * Last activity: [18 years, 7 months ago](https://wordpress.org/support/topic/probleme-with-my-plugin-str_replace/#post-642232)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
