Iterating over every multisite / theme and list the pages

Question

is there a way to iterate over every multisite page and list their sub pages? In my case every multisite has it’s own theme so iterating over every theme would be a possibility.

My Code so far:

$get_guid = [];
$theme = wp_get_theme();
$temp = $theme-> template;
$path = $_SERVER["DOCUMENT_ROOT"] . "/";

function list_pages(){
global $path;
global $get_guid;
global $temp;

$filename = $path . $temp . "_list.json";
$getPages = get_pages();

foreach ($getPages as $pages){
    array_push($get_guid, $pages->guid);
}

$file_list = fopen($filename, "w");
fwrite($file_list, json_encode($get_guid, JSON_THROW_ON_ERROR, 512 ));
fclose($file_list);

}

register_activation_hook(
__FILE__,
'list_pages'
);

0
Sinco 1 month 2023-04-20T02:36:54-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse