Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

post-meta

How to get pictures of the WordPress post

When you upload an attachment from the post edit screen, WordPress set the current post ID as the post_parent of the attachment. And that’s how you get these attachments: $post_ID = 123; $attachments = get_posts( array( ‘post_type’ => ‘attachment’, ‘post_status’ => ‘inherit’, ‘post_parent’ => $post_ID, ‘post_per_page’ => -1, ‘post_mime_type’ => ‘image/*’ ) ); foreach ( … Read more

Categories post-meta Tags gallery, post-meta

Rich Custom Field for Custom Post type not saving

The second parameter on wp_editor is the “metabox” field id/default name and you need to put this in the “update_post_meta” for wordpress to know what to save or specify the correct textarea_name. In display_educadme_related_resources() use: $educadme_resources = get_post_meta($post->ID, ‘related-editor’, true); And in save_educadme_related_resources() use: update_post_meta($post->ID, “related-editor”, $_POST[“related-editor”]);

Categories custom-post-types Tags custom-post-types, functions, post-meta

Unsure how to add simple checkboxes that write to a small table to admin

Unsure how to add simple checkboxes that write to a small table to admin

Categories admin Tags actions, admin, admin-menu, post-meta

How to sort post_meta in edit.php?

How to sort post_meta in edit.php?

Categories admin Tags admin, post-meta, sort

How do I delete element from a serialized array upon deletion of a post?

Don’t focus on serialized aspect of it. Retrieve data using appropriate API function. Modify the data. Save data back. WordPress APIs take care of serialization transparently, no need to mess with it directly.

Categories post-meta Tags post-meta

WooCommerce wp_insert_post action firing on every save

My suggestion would be to add in a simple flag that checks whether this is the initial time we’ve set our defaults, something such as below: function initial_product_data ( $post_id ) { // lets get out of here if this is not a new product if ( ‘product’ != $_POST[‘post_type’] ) return; //Grab our initial … Read more

Categories actions Tags actions, post-meta, woocommerce-offtopic, wp-insert-post

How to rewrite CPT-Permalinks the correct way (incorporating meta-box-data)?

It’s a bit simpler to let WordPress handle generating the permastruct when you register your post type. I also recommend against using global variables, there are API functions for most of what you need to accomplish with the rewrite class. function magazine_issues_rewrite() { add_rewrite_tag( ‘%issuenumber%’, ‘([^&]+)’ ); add_rewrite_tag( ‘%issueyear%’, ‘([^&]+)’ ); // post type registration, … Read more

Categories custom-post-types Tags custom-post-types, post-meta, rewrite-rules

Adding custom fields to the Quick Edit screen – puzzled about the column concept

Adding custom fields to the Quick Edit screen – puzzled about the column concept

Categories posts Tags columns, post-meta, posts, quick-edit

If custom field doesn’t exist, or exists and it’s true show title?

empty checks for several things: “” (an empty string) 0 (0 as an integer) 0.0 (0 as a float) “0” (0 as a string) NULL FALSE array() (an empty array) $var; (a variable declared, but without a value) In short, you are running a check if the value evaluates to false or does the value … Read more

Categories PHP Tags custom-field, metabox, php, post-meta

Media Attachment Custom Meta Fields not saving in Media Uploader when using jQuery UI Autocomplete

You have to trigger a change event on your field, i.e. hrld_media_input.attr(“value”, ui.item.value).change();. This will ensure that attachment_fields_to_save will get triggered.

Categories custom-field Tags attachments, autocomplete, custom-field, media, post-meta
Older posts
Newer posts
← Previous Page1 … Page23 Page24 Page25 … Page204 Next →
+ More

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Post Navigation Elementor
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • WPFacet multiple loop displaying duplicate content
  • Get the name of the template/*html file used
  • Fix: WordPress.DB.PreparedSQL.NotPrepared Plugin Check (PCP)
  • Removing unnecessary CSS and JS code from wp_head()
  • hexagonal image gallery. Am I on the right track? [closed]
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
© 2026 Read For Learn
Next Page »
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress