List post by title length

Add the following to your functions.php for the on save. This will create a meta value on save that stores the length of the post title. function save_crosses_title_length( $post_id ) { $title = get_the_title($post_id);//get the title $length = strlen( $title );// get the length of title if ( get_post_meta( $post_id, ‘name_length_crosses’ ) ) {//if meta … Read more

Integrating Yii2 and WordPress

To integrate with wordpress you need to fully execute wordpress. At this point the added value of having yet another framework is probably zero as it will be easier to just do whatever you need in wordpress over the effort of integration, an effort you might need to keep doing on every new release of … Read more

Error When Trying To Login [closed]

Yes, the error is caused by the MyFont’s plugin (or whatever it is called). You should go to their support forum for help, after making sure that you have the latest version (download/ftp transfer manually, or reinstall via Add Plugin).

Delete or edit postmeta with specific meta_key?

Untested, but this might be what you’re looking for: $args = array( ‘fields’ => ‘ids’, ‘posts_per_page’ => -1, ‘post_type’ => ‘attachment’, ‘meta_key’ => ‘background-video’ ); $all_ids = new WP_Query( $args ); if ( $all_ids->have_posts() ) { while ( $all_ids->have_posts() ) { $all_ids->the_post(); update_post_meta( get_the_ID(), ‘background-video’, ” ); } } wp_reset_postdata(); References WP_Query » Usage » … Read more

When I choose category from dropdown then everything working fine.But in backend it checked only child not parent [closed]

You can add custom columns in wp-admin to show parent category. It’s here my code, you can try it (I tested with post_type is post (default)). // Add the custom columns to the post post type: add_filter( ‘manage_post_posts_columns’, ‘set_custom_edit_post_columns’ ); function set_custom_edit_post_columns($columns) { $columns[‘parent_cat’] = __( ‘Parent Category’, ‘storefront’ ); return $columns; } // Add … Read more

I’m unable to call img path using single quotes in an array?

You’re trying to use PHP tags while inside a string: ‘<img src=”https://wordpress.stackexchange.com/questions/302344/<?php bloginfo(“template_directory’); ?>/images/social/facebook-share.png” />’ You need to instead use concatenation: ‘<img src=”‘ . esc_url( get_bloginfo(‘template_directory’) ) . ‘/images/social/facebook-share.png” />’ Or my personal favorite, sprintf(): sprintf( ‘<img src=”https://wordpress.stackexchange.com/questions/302344/%1$s/images/social/facebook-share.png” />’, esc_url( get_bloginfo(‘template_directory’) ) );

Add new post in existing categories using wp_insert_post

post_category is only for Core Categories. Use tax_input instead: $new_post = array( ‘post_title’ => esc_attr(strip_tags($title)), ‘post_content’ => esc_attr(strip_tags($description)), ‘post_type’ => ‘proiecte’, ‘post_status’ => ‘publish’, ‘tax_input’ => array( ‘categorie’ => array(17,16) ) ); $post_id = wp_insert_post($new_post); It may be clearer to other developers, and yourself in the future, if you use something other than categorie – … Read more