wp_handle_upload error “Specified file failed upload test” but still creates attachment?
Try using media_handle_upload() instead, solved a similar problem for me.
Try using media_handle_upload() instead, solved a similar problem for me.
Always use get_permalink( $post_id ) to get the URI of a post. It takes care of changed permalink structures and SSL. Be aware that the similar named function the_permalink() does not accept a parameter. To get the permalink of a custom post type (or a regular post outside of the loop) you have to use … Read more
Well, the code you are using to count views does store the count data as a custom_field value. If I want the functionality you mentioned in question, I’d rather use a custom plugin to create a separate table in database to store view count and respective dates. So doing some queries you can display popular … Read more
If I understand your question correctly, this should work: function get_event_info($event_id = 0, $info = ” ) { global $wpdb; return $wpdb->get_col( $wpdb->prepare( “SELECT meta_value from $wpdb->postmeta WHERE meta_key = ‘%s’ AND post_id IN (SELECT DISTINCT post_id FROM $wpdb->postmeta WHERE meta_key = ‘event_id’ AND meta_value= %s )”, $info, $event_id ) ); } Use this like … Read more
Think of them as array key/value pairs (kinda). These tables are used to store additional data about particular posts, comments, or users. The meta_key is the name by which the meta_value is retrieved, plus you have associations with particular posts, comments, or users by means of IDs. As far as structure goes, that is about … Read more
Store the date time as a single key in the format yyyy-mm-dd hh:mm:ss.
With some trial and error and help from @vancoder , the problem had to do with intval. The only section needing to be modified was the posts_where function. Had to remove the following line: $propertytype_value_number = intval( $_GET[‘propertytype_value_restrict_articles’] ); And change: AND meta_value=$beds_value_number )”; to AND meta_value=””.$_GET[“propertytype_value_restrict_articles’].”‘ )”; I had to also modify the original … Read more
Attachments are attached to a parent post. So when you get an attachment object, look into $attachment->post_parent. If that is 0, the file is not attached. The parent post ID refers always to another post in the posts table, never to an user. To attach the file to a user, you could create a hidden … Read more
Posting the answer that was solved by OP in one of the comments. This way it’s easier to read it. Hopefully a moderator can mark the question as solved. .page-template-template-magazine-php .post-meta, .category-services .post-meta { display:none; }
Figured it out where I had if ( ! empty( $cart_item[‘presc_data’] ) ) woocommerce_add_order_item_meta( $item_id, ‘Olho Direito’, $cart_item[‘presc_right_sphere’] ); I had to change to $data = $cart_item[‘presc_data’]; if ( ! empty( $cart_item[‘presc_data’] ) ) woocommerce_add_order_item_meta( $item_id, ‘Olho Direito’, $data[‘presc_right_sphere’] );