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 9179775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:53:05+00:00 2026-06-17T17:53:05+00:00

So I have a custom meta box which I’m trying to pull dynamic content

  • 0

So I have a custom meta box which I’m trying to pull dynamic content through. I need to be able to loop through some posts pull that info and then store it into an array and then place those arrays within the options array shown below.

This is where I am at so far..

array(
        'label' => 'Overseeing Pastor',
        'id'    => $prefix.'pastor',
        'type'  => 'select',
        'options' => array (
            $args = array('post_type' => 'employee', 'position' => 'pastor');   
            $pastorList = new WP_Query($args); while ($pastorList->have_posts()) : $pastorList->the_post();
                array (
                    'label' => get_the_title(),
                    'value' => get_the_ID()
                ),
            endwhile; wp_reset_postdata();
        )
),

The options part is what I need help with. I understand that this obviously won’t work. Is there a way to store the array as a varibale elsewhere then call for it in the options array? Appreciate any help, I’m ripping my hair out on this one.

  • 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-17T17:53:06+00:00Added an answer on June 17, 2026 at 5:53 pm

    Something like this?

    $options = array();
    $pastors = get_posts($args);
    
    foreach ($pastors as $post) {
        $options[] = array(
            'label' => $post->post_title,
            'value' => $post->ID,
        );
    }
    

    or like this?

    foreach ($pastors as $post) {
        $options[$post->post_title] = $post->ID;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a meta box on a custom post type for width. Im trying
I have a custom loop with posts which are added from the custom meta
I am creating a travel theme in which I have created some custom posts
I'm building a plugin which will pull custom meta post automatically. For example if
I have some custom post meta being generated and am ready to add to
I have a custom meta box(taxonomy) that is positioned on side of my custom
I have custom map image with specific height and width. i need to map
I have a Highstock chart with custom legend box and checkboxes. Every thing is
I have custom scrollbar on one page which I managed to get working. For
I have custom fields on the page which are gathered from the user input

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.