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

Add custom fields after post/page title

There’s the get_post_meta() function to retrieve those data. So basically, you’d write a function in your functions.php file (or in a custom plugin – take “Hello Dolly” as example) and hook it. <?php /* Plugin Name: (#66495) »kaiser« Headway Title Button */ function wpse66495_headway_title_button() { return printf( ‘<div class=”title-btn”><a href=”https://wordpress.stackexchange.com/questions/66495/%s” alt=”https://wordpress.stackexchange.com/questions/66495/%s”><img src=”%s /></a></div>’ ,get_post_meta( get_the_ID(), … Read more

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

How can I setup custom templates for a meta-data query

There’s the core function add_*/get_query_arg() that you can use to append stuff to the query and retrieve it. So simply add a link somewhere, that points to your custom post types single.php template single-{$custom_post_type}.php Then append the query arg which would be ?wpse_meta_key=wpse_some_val and then do a switch on top of your template: if ( … Read more

Categories templates Tags post-meta, templates

update_post_meta after form is submited

The following is a crude example, it can be improved to ensure you’re dealing with integers etc and also shortened overall for brevity but this should get you started. add_filter(‘frm_after_create_entry’, ‘after_entry_created’, 30, 2); function after_entry_created($entry_id, $form_id){ global $post; if($form_id == 7){ //change 7 to the ID of your form $previous_value = get_post_meta($post_id, $key, true); if($previous_value … Read more

Categories functions Tags functions, post-meta

Hard Define Custom Field Value

Instead of directly grabbing the meta, wrap it in a function, then you can provide a default, or, comment out the innards and just return “this”

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

How to make certain content of the post noindex and no follow. not entire post?

Some spiders honor the <noindex>…</noindex> tags within a page so in that case you could simply wrap your FAQ content with <noindex></noindex>. But I honestly don’t know if Google or for that matter which spiders honor the tag. Since this is not really a WordPress question it’s off topic for this forum. You’d more than … Read more

Categories post-meta Tags noindex, plugins, post-meta, seo

Advice Needed for Post Meta Database Efficiency

Short answer- It Depends Long answer- It’s generally faster to query to 1 row in a single table rather than 20 rows of meta information but there are somethings you should cosider 20 custom meta boxes doesn’t mean that there are 20 postmeta values. User might be filling only 5 of them & then that … Read more

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

Function is Missing an Action Hook

Not exactly ‘solved’ — I still do not know why wp_update_post() did not hit the transition of {old status}to{new status} For my situation I simply added the below function to a unique instance of the button above. Not ideal, but hey it works.

Categories hooks Tags front-end, hooks, post-meta, post-status

When editing a post with a custom meta box the values aren’t displaying correctly

I cannot be 100% sure since I can’t test without installing and running you code but I think the problem is that you aren’t echoing your selected markup. <option <?php selected( get_post_meta($post->ID, ‘cpi_dropdown_options’, true), ‘Option 1′, true ); ?>>No</option> The last parameter tells selected to echo output. Edit: Your options aren’t sending a value. Compare … Read more

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

Does post-meta belong in header?

The w3 specification says that only h-tags are allowed inside of the hgroup-tag. The basic purpose of it is to group a main-headline and a sub-headline together. <hgroup> <h1>My maintitle</h1> <h2>Subtitle of my content</h2> </hgroup> edit html5 also adds the header-tag to use within the body. Inside of this any other html element is allowed. … Read more

Categories post-meta Tags headers, html5, post-meta

Cache metadata for set of posts

I did a lot of digging into wordpress, and it looks like WP_Query ends up calling (indirectly) update_postmeta_cache($postIDs); which looks like it is exactly what I need. Hope that helps somebody else out. In 3.5.1 it’s located in wp-includes/post.php#2735.

Categories post-meta Tags optimization, post-meta, wpdb
Older posts
Newer posts
← Previous Page1 … Page17 Page18 Page19 … 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