How to insert dash (-) into database using wpdb and new_to_publish hook?

When we call get_the_title(), then the post title is taken through the wptexturize() function via the the_title filter: add_filter( ‘the_title’, ‘wptexturize’ ); The en-dash and em-dash are replaced with /* translators: en dash */ $en_dash = _x( ‘–’, ‘en dash’ ); /* translators: em dash */ $em_dash = _x( ‘—’, ’em dash’ ); A simple … Read more

Remove link from page title

Perhaps when you removed your a tag you also remove the nested the_title(); function? the_title(); is the WordPress function which spits out the plain text post/page title so having that in your h1 like below should get you the results you’re expecting. Of course there may also be some CSS which is affected due to … Read more

WordPress title as keywords (tags) with excluded stop words

Here is your updated function solving your 2 problems : // Post title as keywords, excluded stop words function title_as_keywords( $word ) { $blacklist = array(‘this’, ‘about’, ‘that’, ‘them’); // Excluded words … $whitelist = array(‘one’, ‘man’, ‘boy’/*etc..*/); // Whitelisted words … if ( (!in_array( $word, $blacklist ) && strlen( $word ) > 3 ) … Read more

Auto update post title and slug when post status is changed

I think I found the solution: add_filter(‘wp_insert_post_data’,’reset_post_date’,99,2); function reset_post_date($data,$postarr) { //update post time on status change $data[‘post_date’] = $data[‘post_modified’]; $data[‘post_date_gmt’] = $data[‘post_modified_gmt’]; //also update title and add the current date to title $data[‘post_title’] = ‘Your Default Title – ‘. current_time ( ‘m-d-Y’ ); //also update the slug of the post for the URL $data[‘post_name’] = … Read more

How to get the title of the random images from media library?

Your first function get_images_from_media_library() only returns images guid, I’d suggest to extend it by returning all image datas : function get_images_from_media_library() { $args = array( ‘post_type’ => ‘attachment’, ‘post_mime_type’ =>’image’, ‘post_status’ => ‘inherit’, ‘posts_per_page’ => 6, ‘orderby’ => ‘rand’ ); $query_images = new WP_Query( $args ); $images = array(); foreach ( $query_images->posts as $image) { … Read more

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