prevent same wordpress post title

I recently ran into a similar issue (rather tackling how to reset slugs that are dirty after importing). This is a snippit of the code I used to reset the slugs: $wpdb->update( $wpdb->posts, array( ‘post_name’ => sanitize_title( $post_to_fix->post_title ) ), array( ‘ID’ => $post_to_fix->ID ), array( ‘%s’ ), array( ‘%d’ ) ); Primarily focus on … Read more

How to get the meta title of a page configured as blog (loop)

Ok, I found the method by myself. This is the code: //… elseif (is_page() || is_single()) { //Page and Post Title global $post; $metatitle = get_post_meta($post->ID, ‘metatitle_value_key’, true); if ($metatitle) { echo stripslashes($metatitle); } else { the_title(); } } elseif (is_home()) { //Using is_home for the blog page //And using get_queried_object $page_object = get_queried_object(); $metatitle … Read more

Changing title bar in browser window of theme “Encounters Lite”

Filter wp_title, get the current page title from your external app, and return that title. Sample code: add_filter( ‘wp_title’, function( $title ) { // check if it the correct page if ( ! is_my_external_app_page() ) return $title; return get_title_from_external_app(); }); The implementation details are up to you.

Admin filter/error if post title is too long

The key thing I think you’re missing is understanding that WordPress doesn’t use a linear path for saving posts. Because posts are autosaved you’ll want to handle this in a way that defines it according to it’s publish status rather than it’s save state. Basically, instead of trying to truncate or adjust the title, do … Read more

How can I retrieve a Featured Image thumbnail using only the Post_title?

You can try the following: /** * Get the featured image by post title (Simple version) * * @see http://wordpress.stackexchange.com/a/158344/26350 * @param string $title Post title * @param mixed $size Featured image size */ function get_featured_image_by_post_title_wpse_simple( $title=””, $size=”thumbnail” ) { $obj = get_page_by_title( $title, OBJECT, ‘post’ ); return ( is_object ( $obj ) ) ? … Read more

Force changing the Site Title and add link

add_filter(‘option_blogname’, ‘filter_name’); function filter_name($string) { return str_replace(‘original’, ‘replacement’, $string); } This code should work, as well as yours. But there’s one catch, you have to use get_bloginfo like this: echo get_bloginfo(‘name’, ‘raw’); If not, bloginfo sanitizes the output, and it eliminates the <a></a>. At the same time is someting good, because if not you would … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)