$ find temp_*.txt | while read A ; do cat $A >> outfile.txt ; done
Текст очень нудной статьи, которая содержит <a href="/article/1">ссылку1</a> и <a href="/article/2">ссылку2</a>.
Текст очень нудной статьи, которая содержит <a ui-sref="article({id:1})">ссылку1</a> и <a ui-sref="article({id:2})">ссылку2</a>.
<?php
header("Content-Type: text/plain; charset=utf-8");
error_reporting(E_ALL | E_STRICT);
set_time_limit(0);
require_once "./wp-config.php";
require_once "./wp-includes/functions.php";
require_once "./wp-includes/formatting.php";
require_once "./wp-includes/taxonomy.php";
require_once "./wp-admin/includes/taxonomy.php";
$json = file_get_contents("test.txt");
$catlist = json_decode($json, true);
//echo "<pre>";
//var_dump($catlist);
//echo "</pre>";
function create_tree_from_list($list, $parent_id = 0) {
foreach($list as $cat => $cat_object){
$name = $cat_object["name"];
$id = wp_create_category($name, $parent_id);
if($id){
echo $name . " (" . count($cat_object['childs']) . "): ID [" . $id . "]<br>";
if(count($cat_object["childs"]) > 0){
create_tree_from_list($cat_object["childs"], $id);
}
}
else{
echo 'Не удалось создать категорию '.$name.'<br>';
}
}
}
create_tree_from_list($catlist);
?>
Disclaimer. Гуглил-перегуглил, простого решения простой задачи не нашел