stworzyłem plugin, który szuka w Postach użytkowników nie działające linki.
Mam problem ponieważ u mnie loklanie dla 6 Postów, ładnie znajduje nie działające linki.
Nie stety podesłałem go do klienta i okazało się że dla 500 postów plugin coś zamula wogule nie wyświetla wyniku, nie jestem pewien czy to problem z większą ilości danych czy może coś innego.
Podaje link do Plugina: http://szymoon.nazwa.pl/plugins/BrokenLinksChecker.zip
Oraz tutaj kod:
if ( is_admin() ) { add_action('admin_menu', 'broken_links_checker_options'); function broken_links_checker_options() { add_options_page('Broken-links-checker-options', 'Broken-links-checker', 'manage_options', 'broken_links_checker', 'broken_links_options'); } } ?> <?php function check_url($nodes) { $master = curl_multi_init(); { $url = $nodes[$i]; $curl_arr[$i] = curl_init(); curl_setopt($curl_arr[$i], CURLOPT_RETURNTRANSFER, true); curl_setopt($curl_arr[$i], CURLOPT_URL, $nodes[$i] ); curl_setopt($curl_arr[$i], CURLOPT_CONNECTTIMEOUT, 20); curl_setopt($curl_arr[$i], CURLOPT_NOBODY, true); curl_setopt($curl_arr[$i], CURLOPT_HEADER, true); curl_multi_add_handle($master, $curl_arr[$i]); } do { curl_multi_exec($master,$running); } while($running > 0); for($i = 0; $i < $count; $i++) { $results = curl_multi_getcontent ( $curl_arr[$i] ); //var_dump(); if($results == null) { $szymon[] = '0 '; } else { } } return $szymon; } ?> <?php function broken_links_options() { $pass = $_GET['url']; ?> <a href="<?php bloginfo('wpurl');?>/wp-admin/options-general.php?page=broken_links_checker&url=find" class="button-primary" style="margin:10px 0 0 0;float:left;">Check Links</a> <?php <?php if($pass == 'find') : ?> <?php $myrows = $wpdb->get_results( "SELECT * FROM wp_posts where post_status = 'publish'" );?> <table style="float:left;clear:both;"> <tr> <th>Title post</th> <th>URL in post</th> <th>Link too edit</th> <th>Status</th> </tr> <?php $good = 0; $bad = 0; ?> <?php foreach($myrows as $a):?> <?php $qwe = $a->post_content ?> <?php foreach($res as $key => $val):?> <?php $nodes[links][] = $val[1]; $nodes[title][] = $a->post_title; $nodes[id][] = $a->ID; ?> <?php endforeach ?> <?php endforeach ?> <?php foreach (check_url($nodes[links]) as $h): ?> <?php $nodes[status][] = $h;?> <?php endforeach ?> <tr> <?php $good++;?> <?php $bad++?> <td> <?php ?> </td> <td> <?php ?> </td> <td> <a href="<?php bloginfo('wpurl');?>/wp-admin/post.php?post=<?php echo $nodes['id'][$i]; ?>&action=edit" target="_blank" >Edit Post</a> </td> <td> </td> <?php endif ?> </tr> <?php endfor ?> </table> <br /> <?php endif ?> <?php } ?>