Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [post-meta]

Post meta is a data set containing additional core as well as custom post information.

0
votes
1answer
12 views

Update post meta date always store 1970-01-07

I want to update the post meta "job_expires" to the current "job_expires" meta data + 1 week but with this code always store 1970-01-07 as date. $lejar_datum = get_post_meta($job_id , '_job_expires', ...
0
votes
0answers
14 views

SQL query that returns a list of duplicate posts IDs, comparing their post_parent and a post meta value?

I want to build a SQL query that would fetch all the duplicate posts; by comparing their post_parent and the 'link_url' post meta. ID | post_parent | link_url meta 1 11 ...
0
votes
1answer
20 views

How to create meta fields with more than 1 relation?

I am creating a recruitment plugin. There's a custom post type called opening, and it has a metabox which displays a select field with a list of candidates(each option's value is the candidate's ID as ...
0
votes
1answer
22 views

Returning a custom content types with meta values

I find myself facing a situation where I will have a bunch of custom post types and I want to select those with specific meta values. There is a slight wrinkle in that the value I want to select ...
-1
votes
0answers
18 views

WordPress post views per location

I've been working on a WordPress theme that allows users to add a custom post type from the front end. I'm working on a new addition to the site with Chart JS, where my users can see statistics about ...
0
votes
1answer
17 views

Adding Custom MetaData

In Professional Wordpress Design & Development the author states that WordPress features a simple function to add new post metadata called add_post_meta(). This function will attach a piece of ...
0
votes
0answers
13 views

Commas in meta fields when saving or updating posts via the API

I'm saving and updating posts via the API and running in to an issue where any post meta that has a comma in it is getting split up in to multiple meta items. An example would be a post with a meta ...
0
votes
1answer
20 views

How can i show post views using specified post ID?

Here is the code... if ( !function_exists( 'getCrunchifyPostViews' ) ) { function getCrunchifyPostViews($postID){ $count_key = 'post_views_count'; $count = get_post_meta($postID, $count_key, ...
0
votes
0answers
8 views

Use data from API call to populate post_data to support the Social Warfare plugin in an hybrid SPA wordpress

I'm trying to figure out how to have Social Warfare use something different than $post_data, or to use a filter to change $post_data to what I want before it gets used. Our website has two parts: ...
0
votes
0answers
13 views

Getting custom field dynamically from variable

I feel like this should be relatively easy but for some reason I'm lost. I'm trying to access an associated posts ACF repeater field based on what row is being outputted. Here's the query in ...
0
votes
0answers
17 views

Can't update WooCommerce payment method title

Trying to update the WooCommerce payment method as part of an AJAX call. I'm currently running this line; function ajax_payUsingVCAccount(){ update_post_meta( esc_attr( $_POST['order_id'] ), '...
1
vote
1answer
26 views

Is it possible to store Json data in post_meta and manipulate

I just want to add json data type in post meta field as like in normal database. json data will be in the structure below, Post Name Meta Data 1.Sample title 1 ---> ...
0
votes
0answers
15 views

What is the enclosure filed and what are its benefits?

When I have a publish a post with a video on it, the enclosure custom field applied. Is it important if I delete them from the database?
0
votes
0answers
20 views

Is it possible to pass an whole array using custom field in wordpress?

I want to pass array using a textarea custom field to single.php file but it`s not working using: $cr_table_array_new = get_post_meta($postid, 'fields_details', true); I defined array like this in a ...
2
votes
2answers
133 views

Meta query interfering with orderby relevance

I'm trying to re-order the search results using the pre_get_posts hook and set the orderby parameter to relevance. I also want to put priority posts, which is based on post meta _prioritize_s to be ...
0
votes
0answers
19 views

How can I filter posts when the meta_value is a serialize object?

I'm doing a dropdown in my post custom type just to filter the content when is completed or not. my meta_value is a serialize object like "a:3:{s:5:"email";s:21:"mrsxcvsfesr@gmail.com";s:9:"store";s:...
0
votes
1answer
29 views

How enter custom post meta or custom field on box post list archive page?

I ask a question that I think many people are interested in knowing the answer. What I really can't do with wordpress is to insert custom meta or dynamic custom fields into the post boxes (on the ...
0
votes
0answers
13 views

How to speed up UPDATE wp_postmeta queries?

When i do update to wp_postmeta value it's slower than expected: # Query_time: **1.482146** Lock_time: 0.000157 Rows_sent: 0 Rows_examined: 30 use the-db; SET timestamp=1556258093; UPDATE `...
0
votes
0answers
21 views

How to get all posts together with its category and set each as a class name?

I am trying to retrieve all posts to be displayed on a page. And i plan to use this W3 Resource filter mechanism (javascript in snippet plugin). I already have the category names for each post. For ...
-1
votes
2answers
54 views

Retrieving custom field as shortcode

I have added a custom field to my site called "dansk_url", to which a link to the version in Danish (different domain) will be entered. I would like to be able to output this as a shortcode to add ...
2
votes
0answers
15 views

How to change ID of an attachment in wp_posts and its related tables correctly?

I have two posts in my wp_posts table where post_type='attachment' The picture below shows the records related to those in wp_postmeta table I need to change the IDs of those files. What I am doing ...
0
votes
1answer
26 views

Blogposting Schema & Structured Data without plugin

I would like to add blogposting schema markup so each new post is automatically optimized for rich data. Some code on the web is messy and needs updates per each post, also plugin is not best option ...
0
votes
1answer
43 views

How to get post by meta value

I am trying to get post of custom post type by two meta value but it does not work. I have followed lots of article but not worked below are my code. Note: 1. first meta value is a type of date eg: '...
2
votes
1answer
148 views

Using Advanced Custom Field (ACF) to insert meta description on each page

I have used ACF hundreds of times but never to edit the meta description. I have created a simple text field in ACF, then tried to use this script: <?php $meta_description = get_field('...
1
vote
2answers
27 views

how to build (custom) stats for post views, per month

Does anyone know how I could code something to get the most viewed posts per month (without Jetpack), ideally without having to create a new DB table ? Maybe there is a smart way to achieve this only ...
0
votes
0answers
90 views

Custom Fields Not Showing (ACF not installed)

Custom Fields not showing on edit page. When I look at Screen Options it doesn't even show up. I've looked around for a while and saw that people who had the Advanced Custom Fields ran into the same ...
0
votes
1answer
23 views

How add multiple wp_editor_box to new post

I am trying to use multiple wp_editor_meta_box to my posts for custom post_meta but the problem is when I use the same codes for each of them there is an error Fatal error: Cannot redeclare ...
0
votes
1answer
75 views

Wordpress yoast seo plugin - parse snippet var in meta description

I am using this function to get the yoast meta description $metadesc = get_post_meta( $id, '_yoast_wpseo_metadesc', true ); But it is returning the snippet variable. From transitional styles %%...
2
votes
2answers
30 views

Get post from meta_key and meta_value

I have this sql statement: SELECT post_id FROM wp_postmeta WHERE meta_key = $param1 AND meta_value = $param2 I am facing one problem: I don't know how to do that sql code with wordpress ...
0
votes
0answers
34 views

Display multiple meta_key/meta_values by single SQL query

This is my query SELECT P.ID, P.post_title, P.post_content, P.post_author, MAX(IF(PM.meta_key = 'ex_latitude', PM.meta_value, NULL)) AS lat, MAX(IF(PM.meta_key = 'ex_longitude', PM.meta_value, NULL)) ...
1
vote
1answer
23 views

meta_post_meta return value 1

I want to return some post meta , but when i use the functions get_post_meta or get_post_custom the functions returns allways the values 1 for all the meta data, i tried several thinks but they ...
2
votes
0answers
96 views

Transition from (classical) serialized custom meta field to (gutenberg) rest enabled meta

I have a custom meta box for saving values from two input fields into a single post meta field. The data is saved serialized in the DB: get_post_meta( $post->ID, '_custom_key', true ) will ...
0
votes
0answers
81 views

Attachment metadata randomly missing

I have this website with about 3000 posts and 4000 images in the media library. For a long time now, some image thumbnails will randomly disappear from the media library: When I click to open the ...
0
votes
1answer
17 views

Using a comma instead of a pipe to separate metadata

The default way WordPress separates different types of meta data, such as in the post meta data, is using a pipe |. For example, Author Name | Date | Cat1, cat2, cat3 On a Wordpress site, with an ...
2
votes
2answers
311 views

Regenerate missing _wp_attachment_metadata

For some reason, some of the thumbnails of my media library are randomly becoming missing. I've found out _wp_attachment_metadata isn't present in the database for those images with missing ...
0
votes
0answers
27 views

Export media library with metadata and import into new blog

I am looking for a way to export my media directory, along with all meta data and import into a new blog I can download all files via ftp, but i would lose all title and alt attributes associated ...
0
votes
0answers
13 views

How to edit post meta data on Wordpress

i have news aggregator site i want to make on homepage under title to show source like here https://i.postimg.cc/QMmwQCrb/STACK-OV.png
0
votes
1answer
175 views

Save/update post_meta with Gutenberg from the panel

I've created a block, and I need to save as post_meta a value from an action on the panel. Php side: add_action( 'init', 'yasr_gutenberg_show_in_rest_overall_meta' ); function ...
0
votes
0answers
11 views

Hidden Form Custom Post Meta Field for Storing Post_id using PHP and save_post hook

In order to send email notifications to registered users when a new listing matches their breed and location preference, need the post_id stored in a meta field to have post_id parameter available for ...
0
votes
1answer
24 views

Hide Page Title with Post Meta

I tried to write code to have a checkbox on Pages in the backend to check if I want to hide the title of the page in frontend. But I find that the post meta is sometimes reset to show the title even ...
0
votes
1answer
48 views

Custom post type suddenly stoped working after WordPress 5 update

I build a simple plugin that has a CPT and 1 metabox section that collect extra information from admin. It was working fine in the old version but when i just updated it to WordPress 5 it stopped ...
2
votes
1answer
34 views

Some post meta fields stop saving after a few successful saves

I've only experienced this a few times: I have a plugin with many meta fields for pages and other post types. Very occasionally, the update_post_meta() function won't have any effect with just one ...
0
votes
1answer
21 views

Batch Extract Date from post title and put into ACF custom field

I have a custom post type called 'events' with around 700 posts, the titles are consistently formatted like this: Event Title - January 1st 2019 I need to isolate the date in another field. I am ...
0
votes
1answer
29 views

SQL query to change the value of a Custom Field

I am looking for a SQL query to change the value of a custom field, but not on all posts. Some posts have in the "post_template" custom field a "temp1" value, and I want to change this value to "...
0
votes
1answer
90 views

wp_query with ajax

I am trying to filter posts by year using WP_QUERY with AJAX And the current builder i am using is DIVI(for front end). Result Everything loads fine and i am facing one final roadblock that is when ...
0
votes
1answer
24 views

Archieve.php not loading for custom post type

I have a post with a category of blog . So i came across with this archieve.php , whereby we can edit the layout and content of a custom post type. From what I understand archieve.php contains the ...
0
votes
0answers
21 views

Attachment metadata has value of '1'

While accessing /wp-json/wp/v2/media endpoint I'd got an error 500. Checking the logs, I'd seen the following issue: PHP Recoverable fatal error: Object of class stdClass could not be converted to ...
0
votes
1answer
11 views

Suggestion to make posts have multiple associated items

I'm developing a WordPress theme and I need some expert advice to achieve a little complex result. My theme has a custom post type and that post type should have child items. For example the post is ...
1
vote
1answer
24 views

Get thumbnail url of custom meta image?

I have a line in my child theme as follows: $bg_image = wp_get_attachment_url( get_post_meta(get_the_ID(), 'bg_image', true) ); It successfully provides me with the url of the image stored in the ...
0
votes
0answers
14 views

Change picture attachment meta of all occurrences of a picture

I have a custom post type with multiple body copy boxes. I want to achieve the following. Add an image attachment to one body copy box. Add the same image to another body copy box by selecting it ...