我们如何将Jetpack subscriptions
的电子邮件地址从WP
文件导入CSV
?
答案 0 :(得分:0)
Jetpack subscriptions
未托管在您的网站上,而是托管在WordPress.com
服务器上。因此,您无法直接添加到数据库中。
但是,如果您查看Jetpack插件代码,它会概述用于与XML-RPC
交互的WordPress.com
调用并添加订阅者。所以你可以建立自己的导入器......
<?php
//1. the "file_name_here.csv" should get changed to your need
//2. the script just needs to get placed on site like "example.com/subscribe.php"
//3. just execute it in the browser using your link
require_once($_SERVER['DOCUMENT_ROOT'].'/wp-load.php');
$row = 1;
if (($handle = fopen("file_name_here.csv", "r")) !== FALSE) {
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
$num = count($data);
echo "<p> $num fields in line $row: <br /></p>\n";
$row++;
for ($c=0; $c < $num; $c++) {
$email = $data[$c];
echo $email . "<br />\n";
Jetpack_Subscriptions::subscribe( $email );
}
}
fclose($handle);
}