Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7742527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:17:54+00:00 2026-06-01T09:17:54+00:00

I am trying to array posts containing the value X within their meta_value. I’ve

  • 0

I am trying to array posts containing the value X within their meta_value. I’ve go this so far:

<?php $pagestack = get_pages( array(
                        ...
                        'meta_value' => 'X'
                    ) );
                        echo '<ul>';
                        foreach ($pagestack as $post){
                            echo '<li>...</li>';
                        }
                        //endforeach;
                        echo '</ul>';
                     ?>

This shows me all pages that have an exact meta_value of X. But in fact my meta_values hold more information than just the X. So now I want to check the meta_value first if it CONTAINS this certain value. How can I do that. I can’t figure it out myself.

Thanks for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T09:17:55+00:00Added an answer on June 1, 2026 at 9:17 am

    Question is confusing because you mention posts yet your query is "get_pages" which is for pages, they are not the same.

    Regardless of either, you can just do a traditional wordpress loop, and then use get_post_custom to return an array of values for 1 field. Also look at the related function in the link.

    http://codex.wordpress.org/Function_Reference/get_post_custom

    Is is also worth noting that using WP Query gives you a lot more room to work with when using the loop and custom fields as can be seen here,
    http://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get something like this working: function posts_formatter (&$posts){ foreach ($posts as
I'm trying to make will_paginate's :order to work with this array: @posts = current_user.subscribed_tags.map(&:posts).flatten.paginate(:page
I am trying to sub-array in MATLAB with no luck. This is what I
I came across this as I was trying to learn array and vectors in
Trying to sort this array of objects according to (1) depth and (2) weight,
Trying to get a value out of 2d array inside of a hash and
I'm trying to build an array within The Loop of values provided from various
I've been trying to use a PHP integer array for a MySQL query that
I'm just trying to make PHP Connector to Facebook for posting wall posts on
i am trying to build up a single.php page. this page is used to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.