çok basit bi yaklaşımla ;wp-includes altında post.php
PHP- Kodu:
$wpdb->query( "INSERT IGNORE INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_excerpt, post_status, post_type, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type) VALUES ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_content_filtered', '$post_title', '$post_excerpt', '$post_status', '$post_type', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$pinged', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type')");
$post_name yi kendimize göre değiştirebiliriz.sayfanın başına bi fonksiyon atarak kendi url mizi kendimiz yaparız.
PHP- Kodu:
function StripUrl($title)//senin zevkine kalmış { $title = str_replace("#", "", $title); $title = str_replace("/", "", $title); $title = str_replace("$", "", $title); $title = str_replace("&", "", $title); $title = str_replace("&", "", $title); $title = str_replace("+", "", $title); $title = str_replace(",", "", $title); $title = str_replace(":", "", $title); $title = str_replace(";", "", $title); $title = str_replace("=", "", $title); $title = str_replace("?", "", $title); $title = str_replace("@", "-", $title); $title = str_replace("<", "", $title); $title = str_replace(">", "", $title); $title = str_replace("%", "", $title); $title = str_replace("{", "", $title); $title = str_replace("}", "", $title); $title = str_replace("|", "", $title); $title = str_replace("\\", "", $title); $title = str_replace("^", "", $title); $title = str_replace("~", "", $title); $title = str_replace("[", "", $title); $title = str_replace("]", "", $title); $title = str_replace("`", "", $title); $title = str_replace("'", "", $title); $title = str_replace("\"", "", $title); $title = str_replace(" ", "-", $title); return $title;//ucwords le felan ilk harfi büyük yapabilirsin. }
$post_name yerinede StripUrl($post_title) yazarsak , konu yazarken başlığı nasıl yazmışsak irili ufaklı db ye post_name i öyle ekler.Localde linkler sorunsuzdu ama mutlaka bi yerde patlak verir
|