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

Custom Form Data save after Login User

Just inspect the $_POST values on your login page. add_action( ‘login_head’, ‘wpse_98289_custom_form’ ); function wpse_98289_custom_form() { var_dump( $_POST ); } You can there search for the values that you assigned as name/id attributes and then start populating your custom/additional fields in your login form.

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

Save post_parent in a custom post type

You could use the wp_insert_post_data filter instead, which gives you direct access to the post’s data. function wpa_insert_post( $data , $postarr ){ //do something with $data[‘post_parent’] return $data; } add_filter( ‘wp_insert_post_data’ , ‘wpa_insert_post’ , ’99’, 2 ); UPDATE: I added the following to your code and it’s working: function wpa_insert_post( $data , $postarr ){ //do … Read more

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

Build Array from Input Fields question

If two fields are named people[name], only the last value will be sent with the form. To be completely reliable, you’ll need to use an id for each person you’re collecting details on: <input name=”people[0][name]”> <input name=”people[0][email]”> <input name=”people[1][name]”> <input name=”people[1][email]”> … Use an incrementing counter in your while loop to do this ($i): <?php … Read more

Categories custom-field Tags array, custom-field, post-meta

Colecting values from custom field checkboxes and displaying them in the post

In your code you are only creating one custom field with your add_post_meta() usage. Then when you use the get_post_meta() there is only one value in the post. Can you go into the actual post and look at the custom fields. Is there more than one custom field with the same “extras” key? If not, … Read more

Categories custom-field Tags custom-field, post-meta

wp_postmeta store multiple values in one key [closed]

If I follow you correctly you want an array of arrays. $get_ref = $_SERVER[‘HTTP_REFERER’]; $ref = get_post_meta($post->ID, ‘page_ref’, true ); $ref[] = array($get_ref); //or $ref[][] = ‘xyz’ …if you prefer update_post_meta($post->ID,’page_ref’, $ref);

Categories post-meta Tags array, post-meta

getting image alt text via ACF plugin in WordPress [closed]

You need to set your ACF field to return the image object instead of the URL. You can then use the following code to retrieve the image and alt text: <?php $slideshow_image = get_field(‘slideshow_image’); // Check for alt text – if there isn’t any, use the image title $alt = ($slideshow_image[‘alt’]?$slideshow_image[‘alt’]:$slideshow_image[‘title’]); // Return full size … Read more

Categories plugins Tags html, images, plugins, post-meta, seo

Custom Post Type meta value is being saved in array, instead of just the string (as value)

Your issue is not with storage, it is with retrieval. get_post_custom() is inconvenient and rarely used in practice. get_post_meta() is more common in practice. Note it has explicit argument to retrieve a single value, rather than array of values for a key (which WP can do too).

Categories custom-post-types Tags custom-post-types, get-posts, post-meta

Display post_meta-by_key on product catalogue

That’s because get_post_meta_by_key() isn’t a WordPress function. What you’re likely looking for is get_post_meta(): add_action( ‘woocommerce_after_shop_loop_item’, ‘display_author’ ); function display_author() { global $post; echo get_post_meta( $post->ID, ‘author’, true ); } Not tested, because I don’t have a WooCommerce install handy (and WooCommerce specifics are off-topic here anyway) but this is pretty standard so it should … Read more

Categories functions Tags functions, post-meta, woocommerce-offtopic

How can i remove blank area caused by theme’s post meta boxes?

Here is few steps: Right click on your area what you want to change/remove and inspect in console. Find in console HTML part what you want change/remove Look if have some ID or unique class. If you find some unique ID or class, just simple add custom CSS in your template with property display:none !important; … Read more

Categories metabox Tags metabox, post-meta

Retrieving custom field as shortcode

Put this in functions.php of your theme. add_shortcode( ‘dansk_url’, ‘dansk_url’ ); function dansk_url() { $output=””; $the_url= get_post_meta( get_the_ID(), ‘dansk_url’, true ); if ( $the_url) $output .= ‘<a href=”‘ . esc_url( $the_url) . ‘”>Dansk</a>’; return $output; } and use shortcode [dansk_url] in the post.

Categories custom-field Tags custom-field, post-meta, shortcode
Older posts
Newer posts
← Previous Page1 … Page10 Page11 Page12 … Page203 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
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 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