Insert Tag in WordPress Post

If you are using wp_set_post_tags this you can pass either array of exiting tags id or array of string. If it is a string then it will create a new one and assign that, if you are passing an id then it will assign that term_id of post_tag. As per your code I can see … Read more

How to get total posts count for each date?

Instead of the second loop, do the following: Count the posts per date Display them as you will // Count the posts per date $count = []; foreach ( $posts as $post ) { $date = get_the_date( ‘Y-n-j’, $post ); $count[ $date ] = ! isset( $count[ $date ] ) ? 1 : $count[ $date … Read more

When inserting media file in a post or page, show file name under the thumbnail

By default, WordPress doesn’t provide a built-in option to sort media attachments by file name in the media library interface. However, you can achieve this programmatically or with the help of plugins. Using Plugins: Plugins like “Media Library Assistant” or “Media Library Categories” offer advanced sorting and filtering options for the media library, including sorting … Read more

How to display breadcrumb on category?

If you’re dealing with the default “Category” taxonomy and the post post type, then you can get the post’s attached category terms with get_the_category(). $categories = has_category( $post ) ? get_the_category( $post ) : array(); The has_category() check is there just to fend off other post type posts. get_the_category() gives you an array of categories … Read more

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