فقط اولی اجرا میشه

پرسیده شده
فعالیت 1393 روز پیش
دیده شده 836 بار
0
<?php
/**
* Plugin Name: Filtering Words Plugin
* Plugin URI: Bashkan.ir
* Description: This is a Plugin To filter the words on the content
* Version: 1.0.0
* Author: Son of The God
* Author URI: Bashkan.ir
**/

define('WP_DIR_DIR',plugin_dir_path(__FILE__));
define('WP_DIR_URL',plugin_dir_url(__FILE__));
define('WP_INC',WP_DIR_DIR.'/inc/');

function wp_filter($wp_filter_content){
$word= array("/کلمه 1/","/کلمه 2/", "/کلمه 3/");
$replace=  array("<a href='https://somaddress.com'>".$word[0]."<a>", "#" ,str_repeat("#",strlen($word[2])));

$wp_filter_content=preg_replace($word,$replace,$wp_filter_content );

return $wp_filter_content;

}
add_filter('the_content','wp_filter');


?>

مشکل اینجاست که فقط فیلتر اول صورت میگیره

فایل پیوست

Ali sadeghian
Ali sadeghian

8 تیر 99

0
حذف شده

سلام و عرض ادب

توی آرایه دوم "#" باید با بک اسلش نوشته بشه یعنی "\#" به این صورت و مجددا تست کنید

فایل پیوست

سید حسین موسوی

توسط

سید حسین موسوی

16 تیر 99