Tag Info

New answers tagged

1

Working code: // Add custom column with file size info to attachment page add_filter( 'manage_media_columns', 'bb2_manage_media_columns', 10, 2 ); function bb2_manage_media_columns( $columns ) { $columns['filesize'] = __( 'Storlek', 'bb2' ); return $columns; } add_action( 'manage_media_custom_column', 'bb2_manage_media_custom_column', 10, 2 ); ...


0

After some research, I found that Custom Post Types don't store post_parent for attachments or may be requires some tweaking with register_post_type(). However, I found that when uploading attachments to regular posts, WordPress sends a post_id with AJAX and same is not happened with Custom Post Types. So, we need to assign post_id to Custom Post Type media ...


0

You are most likely looking at the attachment page when visiting the url. It is default Wordpress behavior to create a page for every image you upload. If you don't want these attachment pages to be accessible, you can block access to it. To do this, edit the file attachment.php (or image.php if you want to just block access to the images) in your theme or ...


6

An attachment is a Post The posts table contains information on the attachemnt post. In WordPress every uploaded media has it's own post entry, where post_type is 'attachment' and post_status is 'inherit'. In fact, you can get attachment post types using functions used to get other post types, like post, page or any CPT. That include WP_Query, ...


1

First is showing the attachment file path, second is file attributes size, type, height, width etc. Thanks attachment in wp_post shows the attachment basic details title, time, author etc. wp_postmeta shows attachment all other details for example attachment would be text, pdf, image etc so it having different meta data for different types of posts. ...


0

How will you represent the galleries on the new site? Will each gallery be a post with a standard [gallery ids=...] shortcode? If so, you'll basically only need the url for each image on the old site (plus post heading/text and image descriptions if needed), and you can create a WXR import file to import everything into the new site. Example, an import ...


0

Although I see this question not specific to WordPress (at least the answer it's not), I see similar questions posted in a regular basis and I think it is good to give a answer. If a URL doesn't exist, in your case the URL is for a non-existant attachment, 404 is the correct HTTP status code. Nothing to worry about. The problem would exist if a correct URL ...


1

You are not providing a correct attachement ID. Replace: $image_alt = get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true); With: $image_alt = get_post_meta( $image->id, '_wp_attachment_image_alt', true); Note: I assume that $image->id is correct because you use it later in your code and you get the expected result. Unfortunatley ...


1

You can try adding the input file field once and using then using jQuery to add more fields when clicking add more. Here are the steps Register your setting using register_setting function Create Menu using add_menu_page. This also requires a calback function Add the thickbox and media-upload script using wp_enqueue_script and wp_enqueue_style Use the ...



Top 50 recent answers are included