Skip to content

Armstrongest

Programming, Patterns, and Paradox

  • Code
  • Musings
  • Design
  • Contact

Tag: custom fields

How Get all WordPress posts that have a custom field

Posted on January 7, 2019 by Gary Armstrong
I need all the meta data from Commander Data

Sometimes, you just need to get a list of posts, that contain a specific piece of metadata and output them as a list. Instead of getting a list of each post and then looping over all the posts and checking for metadata, it’s a relatively simple SQL statement. If you had a list of product […]

Posted in Code, Snippets Tagged code, custom fields, get_post_meta, sql, wordpress Leave a comment

How to get posts that do NOT have a custom field value

Posted on December 13, 2018December 13, 2018 by Gary Armstrong

The way WordPress decided to deal with adding custom pieces of data is both cumbersome and elegant. Because it stores ALL metadata in one table, it can be painful to try to figure out what a data object looks like. Things like adding Foreign keys and enforcing certain relationships can not be done easily. Your […]

Posted in Code, WordPress Tagged custom fields, Database, sql, wp_postmeta Leave a comment

Recent Articles

  • PHP 7 and the Null Coalescing Operator ?? April 27, 2019
  • How Get all WordPress posts that have a custom field January 7, 2019
  • How to get posts that do NOT have a custom field value December 13, 2018

Archives

  • April 2019 (1)
  • January 2019 (1)
  • December 2018 (1)
  • May 2017 (2)
  • April 2017 (2)
  • March 2017 (1)
  • February 2017 (1)
  • January 2017 (4)
  • October 2016 (1)
  • September 2016 (3)
  • August 2016 (1)

Categories

  • Code (17)
  • Design (1)
  • Lab (1)
  • Musings (7)
  • Snippets (1)
  • WordPress (9)
Proudly powered by WordPress | Theme: armstrongest by Gary Armstrong.