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

Get page->parent’s name?

Once you’ve got the id of a post or page, use get_the_title($id) to get the page title (which is what I assume you mean by name) Codex Reference

Categories post-meta Tags post-meta

Trying to get file name

Your meta field contains the ID of the attachment, you need to fetch that ID, then get the filename using that attachment ID. $doc_id = get_post_meta( get_the_ID(), ‘pdf’, true ); $filename = basename( get_attached_file( $doc_id ) ); echo $filename;

Categories post-meta Tags post-meta

trying to do if post meta !=0

The reason you have a problem is 0 is also considered equal to false, when the get_post_meta call returns false, it’s also the same as being equal to 0. if( !get_post_meta( $post_id, ‘some-non-existant-field’, true ) == 0 ) Would be the same as … if( get_post_meta( $post_id, ‘some-existing-field’, true ) == 0 ) ..the only … Read more

Categories post-meta Tags post-meta, rating

Query 2 meta key values and a category

The query value parameters can be set to true ( returns single result) or false ( an array). http://codex.wordpress.org/Function_Reference/get_post_meta For instance http://www.mattvarone.com/wordpress/query-multiple-meta-values/

Categories post-meta Tags post-meta

Generate an Email address from that of the Post Author

You can use get_the_author_meta function. You can learn more about it here: https://developer.wordpress.org/reference/functions/get_the_author_meta/ Usage in your case: <a href=”https://wordpress.stackexchange.com/questions/290522/mailto:<?php echo get_the_author_meta(“user_email’);?>?subject=<?php the_title(); ?>”>Apply</a>

Categories post-meta Tags author, email, post-meta

Views count with time limit per IP

A very basic solution would be to use the Transients API, an example… function setPostViews($postID) { $user_ip = $_SERVER[‘REMOTE_ADDR’]; //retrieve the current IP address of the visitor $key = $user_ip . ‘x’ . $postID; //combine post ID & IP to form unique key $value = array($user_ip, $postID); // store post ID & IP as separate … Read more

Categories post-meta Tags post-meta

Create a Metabox that behaves Like a Taxonomy Box

i ended up building a plugin that enforces radio buttons for any taxonomy. http://wordpress.org/extend/plugins/radio-buttons-for-taxonomies/ for the project in question i will probably also save the taxonomy as meta. sucks that i need/want half the ability of taxonomy (knowing other available terms, etc), but need the sorting by meta.

Categories post-meta Tags post-meta

How trigger to save post when updating post meta

I’ve used this to insert posts with ACF/postmeta data successfully, but please test it on a development site before deploying live, there might be some terrible assumptions. Generally, it assumes that you only have each name once, that is “myfield” doesn’t exist in two field groups with different meanings. $mycustomvalue = 123; $f_mycustomfield = get_acf_key_by_name(“mycustomfield”); … Read more

Categories post-meta Tags post-meta, wp-update-post

Is it possible to update a post meta field through REST API if the format of it when registered is nested?

Is it possible to update a post meta field through REST API if the format of it when registered is nested?

Categories post-meta Tags post-meta, rest-api

Options to get my custom post type metadata via the WordPress API

You should use register_meta to add the meta field to the rest controller. Here the example from the link to expose the field my_meta of the custom post type my_article: register_meta(‘post’, ‘my_meta’, [ ‘object_subtype’ => ‘my_article’, ‘show_in_rest’ => true ]);

Categories post-meta Tags api, json, metabox, post-meta, rest-api
Older posts
Newer posts
← Previous Page1 … Page40 Page41 Page42 … Page51 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