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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:20:44+00:00 2026-05-27T18:20:44+00:00

This is my first time using Pods in WordPress, so forgive me if this

  • 0

This is my first time using Pods in WordPress, so forgive me if this is a bit of an easy question to answer. I’ve done a bit of searching for an answer to this problem, but haven’t found anything that answers my question specifically.

I have two different kinds of pods created.

  1. Areas of Study: Such as Physics, Sociology or Computing
  2. Case Studies: Details on case studies performed in various areas of study

Each Case Study Pod has a relationship field linking it to a specific Area of Study Pod. (In this example, assume that a specific case study can only be related to a single area of study. This may change in the future, but for now, this should suffice.)

Each Area of Study has a relationship field linking it to a specific WP Page (e.g. a detailed page that describes the details for the Physics Area of Study).

What I want to do, is while looping through various Case Studies, be able to obtain the link for the WP Page, it’s specific area of focus is related to.

I technically know HOW to do it, but I’m not sure it’s the most efficient way of doing it.
This is what I have done, and it seems to be working:

<?php 
$case_studies = new Pod('case_studies');
$case_studies->findRecords(null, 200);
$total_rows = $case_studies->getTotalRows();

if ($total_rows > 0) {
        while ($case_studies->fetchRecord()) {
                // RETRIEVE AREA OF FOCUS DETAILS
                $aof = $case_studies->get_field('area_of_focus');
                $aof = $aof[0];

                // GET AREA OF FOCUS POD
                $aofs = new Pod('areas_of_focus');
                $params = array('where' => "t.id like '".intval($aof['id'])."'");
                $aofs->findRecords($params);
                if ($aofs->fetchRecord()) {
                        $page = $aofs->get_field('focus_page');
                        $area_of_focus_url = get_permalink($page[0]['ID']);
                        echo '<a href="'.$area_of_focus_url.'">'. $aof['name'].'</a>';
                } else {
                        echo $aof['name'];
                }

                // CASE STUDY DETAILS GO HERE
        }
}

?>

This seems like it’s at least an O(n²) algorithm, if not more. I really don’t know the internals of the Pod class, so it could be even more expensive than that. Also this will be executing several MySQL queries instead of a single query.

Would it be better if I used some MySQL joins in the initial case study query so that I don’t have to have it run a bunch of other queries? Or are there any other functions within Pods itself, that can allow me to retrieve more details on relationship fields?

Any tips would be greatly appreciated.

  • 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-05-27T18:20:45+00:00Added an answer on May 27, 2026 at 6:20 pm

    You can actually go very deep with get_field by traversing relationships.

    Try this out for size:

    $page_ID = $case_studies->get_field('area_of_focus.focus_page.ID');
    

    Pods will do all the work for you, you can go a ton of levels deep, and you can even do the same with findRecords (as of Pods 1.12)

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

Sidebar

Related Questions

This is my first time using Drupal and I am loving it, but there
This is my first time using Stack Overflow, so if I've done something wrong
This is my first time using IB, but after spending a one or two
The title seems confusing but this is my first time using ternary conditions. I've
This is my first time using a content provider but I followed the developer
This is my first time using SAXParser, (I'm using it in Android, but I
This is my first time using joomla. I don't know if I'm using the
this is my first time using StAX for parsing XML documents (still in the
I'm fairly new to both Django and Python. This is my first time using
This is the first time ever I'm using AJAX, and I want to do

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.