Dynamic post lost in site running 'x'

We write a product that creates dynamic content for pages that do not exist in WP. We create these posts by filtering the_posts, and only kicking in when the url does not exist in the site. When this is true, we check to see if the url (real estate listings) exists.

We’ve done this for years, and works on most themes. But something is happening with the ‘x’ theme. I’ve spent 3 days investigating theme settings that might help, and adding debug to understand the issue.

We create a post thusly:

$post					= new stdClass();
$post->post_author		= get_current_user_id();
$post->post_name		= "1924 County Rd 138";
$post->post_type		= 'page';
...
$post					= new WP_Post( $post );
wp_cache_add( $post->ID, $post, 'posts' );
unset($wp_query->query["error"]);
$wp_query->query_vars["error"]	= "";

$wp_query->is_404		= false;

$GLOBALS['wp_query']	= $wp_query;
$wp->register_globals();

But this post, on the ‘x’ theme, is being discarded by something, somewhere.

This is a page that works (not using ‘x’ theme):
https://islandviewrealty.com/singlefamily/mn/international-falls/1924-county-rd-138/

This is a page that discards this generated content (using ‘x’ theme):
https://staging.islandview.sites.roveridx.com/singlefamily/mn/international-falls/1924-county-rd-138/

I’ve added debug, I can see the_content is generated correctly and before the page is rendered. I added debug to template-blank-1.php, and can see that it’s call to the_content() is returning different content, not the content we generated.

I’m not sure where to look next, and am looking for guidance.

Thank you

Hello There,

Thanks for writing in!

Please be advised that this page: https://islandviewrealty.com/singlefamily/mn/international-falls/1924-county-rd-138/, is a normal page.

On the other hand, this page: https://staging.islandview.sites.roveridx.com/singlefamily/mn/international-falls/1924-county-rd-138/ has been assigned as your Posts Page. If you happened to assigned this as your blog index, then that is the reason why it is not displaying anything like the live page. Please go to Settings > Reading > Front Page Displays and make sure to remove the page as your Posts Page.

Please let us know if this works out for you.

Thanks you for the reply!

Unfortunately, that was not it:

The page /singlefamily/mn/international-falls/1924-county-rd-138/ is a dynamic page. It does not exist in Wordpress. I believe that the ‘x’ theme is interrupting the normal event flow, which we already interupt by telling Wordpress that this 404 is indeed not a 404 (whereby we provide the $post we’ve created), but I have no proof and am looking for guidance to solve.

Perhaps an ‘x’ action or filter I could cancel when such a dynamic page is being generated?

Thank you!

Hi @bostonwg,

The page being displayed is a blog page, it outputs the same for /singlefamily/mn/international-falls/, /singlefamily/mn/, /mn/international-falls/, /mn/. Perhaps it’s a rewrite conflict?

I’m not really sure how you implemented it so I can’t tell what’s the conflict. Would you mind providing your site’s URL and admin login credentials in the secure note? I can’t promise a solution, but if I can find something from the conflict then I may able to add this to our issue tracker.

Thanks!

Hi

Again - I appreciate the reply.

I want to reiterate - because I’m not sure we are all on the same ‘page’. The url /singlefamily/mn/international-falls/1924-county-rd-138/ does not exist. And because it does not exist, we create a post (detailed explanation is above, in my earlier post), and add that post as the ‘found’ page by wp_query. I can see in my debug that we are creating the post, and it’s correctly handed off before the page template renders the page.

This works on hundreds of themes we have tested, and has worked for over a decade. But it is not working on the ‘x’ theme. Instead, as you correctly observe, we are seeing blog posts. As I said, I believe this is because code within the x theme is tossing the post we created for an unknown reason, and generating default (probably down some 404 path) blog posts.

Do you see what I’m saying?

Thanks very much - your continued responses are very appreciated!

Hello There,

X does not, in anyway, modify the WP Query or modify any of the page/post contents. Could you please provide us you WP credentials so that we can investigate?

Meanwhile, please switched to the parent X theme. If the /singlefamily/mn/international-falls/1924-county-rd-138/ url display since you already have created this post, then the problem lies in the modified file found in your child theme.

Kindly let us know how it goes.

The child theme is a base child theme, no modifications. The post is created via a plugin, not a theme modification.

How may I securely provide credentials?

Thank you

Hey There,

To know how to create a secure note, please check this out: https://theme.co/apex/forum/t/how-to-get-support/288

We need to check your site, child theme and other settings for this issue.

Thank you in advance.

I have added a secure note with WP credentials.

Hello There,

Which page is used by RoverIDX to display listing items? Do you have any modifications in your child theme? If possible please provide us a copy of your child theme so that we can check it since we cannot edit the files in Appearance > Editor because of file permission issues.

Thank you in advance.

The Rover content is generated dynamically. There is no page.

I’ve added the child theme https://roveridx.com/stuff/islandview_child.zip

NOTE: When I disable the ‘cornerstone’ plugin (as this is a multisite, you don’t have access to do this), the page /singlefamily/mn/international-falls/1924-county-rd-138/ renders correctly.

Hi @bostonwg,

These are what I found.

  1. In your staging, I switched to Twentyseventeen and it’s the same here https://staging.islandview.sites.roveridx.com/singlefamily/mn/international-falls/1924-county-rd-138/. The only difference are titles and design.

Hence, it’s not due to X theme.

X theme

Twentyseventeen

  1. I can’t find the X theme in your site, I can’t troubleshoot it and it’s probably inaccessible through your provided credentials.

  2. Your child theme is from ElegantThemes, but since you change the target template to X then it should be good

Except, the functions.php content should be

<?php

// =============================================================================
// FUNCTIONS.PHP
// -----------------------------------------------------------------------------
// Overwrite or add your own custom functions to X in this file.
// =============================================================================

// =============================================================================
// TABLE OF CONTENTS
// -----------------------------------------------------------------------------
//   01. Enqueue Parent Stylesheet
//   02. Additional Functions
// =============================================================================

// Enqueue Parent Stylesheet
// =============================================================================

add_filter( 'x_enqueue_parent_stylesheet', '__return_true' );



// Additional Functions
// =============================================================================


Your existing functions.php content/code is probably for ElegantThemes.

All in all, these issues happen on TwentySeventeen too so it’s not theme specific. I recommend troubleshooting and debugging other parts of your site, like plugins and custom codes.

Thanks!

Hi

Your assertion is not quite accurate. If you switch to TwentySeventeen AND disable the Cornerstone plugin, the page https://staging.islandview.sites.roveridx.com/singlefamily/mn/international-falls/1924-county-rd-138/ correctly shows the property listing. I did mention this earlier.

I also did mentioned this is on a multisite (so you don’t have full access), but I’d be happy to put it on a single WP install to show you.

Thank you

Hi,

While we are happy to help with the occasional quick tweak here or there, we are well into the custom development realm, which is outside the scope of support we can offer. If you need in depth changes, you may wish to consult with a developer. X is quite extensible with child themes, so there are plenty of possibilities.

Thanks for understanding.

I’m not sure I understand. I’ve done (I think) a reasonable job of presenting facts that outline an actual problem in your product. But you don’t wish to investigate?

Hello @bostonwg,

Thanks for updating the thread.

It’s our constant endeavour to help our customers. However, we are into the territory of custom development in your case which falls outside the scope of support we can offer. You can get in touch with a developer for some help.

Thanks for understanding.

I honestly do not understand. Your company built this product. I’m showing you that there there is a defect.

Maybe you are saying I should contact one of your developers to continue? If so, how would I do that?

Hey @bostonwg,

Sorry for the confusion. This is not custom development but should be classified rather as a plugin conflict. I see you’ve mentioned that deactivating Cornerstone makes your plugin work. Cornerstone however, is required by X as they share some functions like the mobile menu.

Since this conflict involves a non-standard content creation method, we need to post this to our issue tracker so our development team would be made of this case once they go through the list of reports in due time. They are the ones who can decide if they will provide an investigation and/or a solution for this conflict.

With that said, I’d recommend that you setup a staging site with fresh single WP install and only install X (parent), Cornerstone and your RoverIDX plugin and provide WordPress Admin and FTP access. Also provide the URLs having the issue in the new single staging site.

Please just note that this is not a guarantee that we will provide a solution.

Thank you for understanding.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.