Title: Virtual Post setup issue (Virtual fields work perfectly)
Last modified: September 2, 2018

---

# Virtual Post setup issue (Virtual fields work perfectly)

 *  Resolved [shokks](https://wordpress.org/support/users/shokks/)
 * (@shokks)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/virtual-post-setup-issue-virtual-fields-work-perfectly/)
 * Watched both the videos multiple times:
    _[https://www.youtube.com/watch?v=y0UkzQFk5Ok](https://www.youtube.com/watch?v=y0UkzQFk5Ok)
   [https://www.youtube.com/watch?v=0gvT6Myt1Ck](https://www.youtube.com/watch?v=0gvT6Myt1Ck)
 * However, not being able to make virtual post work – gives me 404. Somehow it 
   is not able to find the slug values in the table. ‘slug’ is a column name in 
   Airtable Table – no capitalization problem (checked 10000 times!!).
 * Pretty sure its something super stupid! 🙁
 * **Virtual Post Config**
 * _URL Pattern to match_: **^/(.\*)/?**
    _Test Url _: (blank) “This test URL matches
   0 records in table Pitch” _Filter by Formula_: {slug} = **‘$1’** _Sort results_:(
   blank) _Airtable Table Name_: **Pitch** _Airtable Field to be used as post\_name_:**{
   slug}** _Airtable Field to be used as post\_title_: **{slug}** _Map to this page_:**
   airpress-single-template**
 * **Logfile excerpt:**
 *     ```
       Pitch Config VirtualPost	^/(.*)/? matched
       DELAYED QUERY : /Pitch : 535538a4f920e8c70678f53d2743ac00	Pitch?filterByFormula={slug} = ''
       Simulated Virtual Post Collection
       #########################################
       AirpressCollection Object
       (
           [query] => AirpressQuery Object
               (
                   [runtime_start:AirpressQuery:private] => 1535924158.8043
                   [config:AirpressQuery:private] => Array
                       (
                           [name] => Pitch Table Configuration
                           [api_key] => key1234
                           [app_id] => app1234
                           [api_url] => https://api.airtable.com/v0/
                           [refresh] => 60
                           [expire] => 86400
                           [fresh] => fresh
                           [debug] => 1
                           [log] => /home/lorem/www/ipsum.com/wp-content/plugins/airpress/airpress.log
                           [id] => 0
                       )
   
                   [parameters:AirpressQuery:private] => Array
                       (
                           [filterByFormula] => {slug} = ''
                           [fields] => Array
                               (
                               )
   
                       )
   
                   [properties:AirpressQuery:private] => Array
                       (
                           [table] => Pitch
                       )
   
                   [relatedQueries:AirpressQuery:private] => 
                   [errors:AirpressQuery:private] => 
               )
   
           [index:AirpressCollection:private] => Array
               (
               )
   
           [storage:ArrayObject:private] => Array
               (
               )
   
       )
   
       #########################################
   
       stash_and_trigger_deferred_queries|Sending ASYNC request to process 1 deferred queries.
   
       AIRPRESS LOADED
   
       AIRPRESS LOADED
       run_deferred_queries|Processing 1 queries
       200	0	0.48	Pitch?filterByFormula={slug} = ''
       run_deferred_queries|Query Pitch?filterByFormula={slug} = '' had 0 records returned. Que Bella!
       stash_and_trigger_deferred_queries|DONE in 0.81519103050232 seconds
       ```
   
    -  This topic was modified 7 years, 9 months ago by [shokks](https://wordpress.org/support/users/shokks/).
    -  This topic was modified 7 years, 9 months ago by [shokks](https://wordpress.org/support/users/shokks/).

Viewing 1 replies (of 1 total)

 *  Plugin Author [Chester McLaughlin](https://wordpress.org/support/users/chetmac/)
 * (@chetmac)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/virtual-post-setup-issue-virtual-fields-work-perfectly/#post-10805904)
 * It would appear that you’re attempting to use VirtualPosts on the “home page”
   of your WordPress site. That isn’t currently supported. you’ll notice in your
   debug output that your slug is empty because you’re matching the entire URL and
   yet you’re only access “/” …
 * If you need to load Airtable data on your homepage, you’ll need to dive into 
   the PHP and add something like this to your theme functions file:
 *     ```
       <?php
   
       function my_airpress_homepage_query( $atts ){
       	global $post;
   
       	if ( is_home() ){
   
       		$my_airpress_connection_id_or_name = 0;
   
       		$query = new AirpressQuery("My Table Name", $my_airpress_connection_id_or_name);
   
       		// Optionally specify View
       		$query->view("My View");
   
       		// Optionally specify Fields (will only return these fields)
       		$query->fields(["Name","Gem Type","Jewel Type","Quick Pics","Good Pics","Certificates"]);
   
       		// Optionally provide a filterByFormula, this one ensures Slug is NOT empty
       		$query->filterByFormula("NOT({Slug},'')");
   
       		// This will ensure that you can use shortcodes on the homepage still
       		// such as [apr field="Slug"]
       		$post->AirpressCollection = new AirpressCollection($query);
       	}
   
       }
   
       add_action("the_post", "my_airpress_homepage_query");
   
       ?>
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Virtual Post setup issue (Virtual fields work perfectly)’ is closed to
new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/airpress_c9d28c.svg)
 * [Airpress](https://wordpress.org/plugins/airpress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/airpress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/airpress/)
 * [Active Topics](https://wordpress.org/support/plugin/airpress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/airpress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/airpress/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Chester McLaughlin](https://wordpress.org/support/users/chetmac/)
 * Last activity: [7 years, 7 months ago](https://wordpress.org/support/topic/virtual-post-setup-issue-virtual-fields-work-perfectly/#post-10805904)
 * Status: resolved