2017-05-05 21 views

回答

0

您最好的選擇是在您的functions.php文件中創建一個新函數,該函數排除現有函數的array_unique()部分。像這樣的東西應該工作 -

function wp_extract_all_urls($content) { 
    preg_match_all(
     "#([\"']?)(" 
      . "(?:([\w-]+:)?//?)" 
      . "[^\s()<>]+" 
      . "[.]" 
      . "(?:" 
       . "\([\w\d]+\)|" 
       . "(?:" 
        . "[^`!()\[\]{};:'\".,<>«»「」‘’\s]|" 
        . "(?:[:]\d+)?/?" 
       . ")+" 
      . ")" 
     . ")\\1#", 
     $content, 
     $post_links 
    ); 

    $post_links = array_map('html_entity_decode', $post_links[2]); 

    return array_values($post_links); 
} 
+0

謝謝!這麼簡單,如此有用! – Igonaf

相關問題