Link to home
Start Free TrialLog in
Avatar of Jerry L
Jerry LFlag for United States of America

asked on

Wordpress Delete Page - Deleting a Page Leaves Remnants in Database

Wordpress 4.7.3
Custom Theme
Firefox Debugger: Firebug

BACKGROUND
We have a Contact page on ../contact/
We also have a Services page on ../services/

PROBLEM DESCRIPTION
The problem is that on the Services page, just under the header, above the page content, there is a horizontal area of red color where it should be black (See screenshot).

No other page is having this problem.
I have deleted the Services page in the Dashboard area, and then created a new page and named it Test. This Test page does not have the red horizontal area. But when I rename it to Services, again, the red horizontal area appears.

It seems that there are parts of the database that are not getting removed when I delete the page. Specifically in the tables: posts and postsmeta. You can see all the revisions still there, for example.

QUESTION
How can I completely remove all remnants, revisions, meta-stuff, etc. of the Services page?

MORE INFORMATION
When I use Firebug: (See Attached Screenshot and SCROLL down to the bottom to the BIG RED ARROW)
Other screenshots to show good and bad pages, and the Contact Page (in which horizontal red area is desired).

1)  For some reason, on the Services page, the style element and properties for contact-form is rendered on the page. Other pages do not have this problem.:
::after
</div>
<div class="contact-form"></div>
The Contact form page has a lot of red background in it, and I think that is what is causing the red horizontal area.
I think this will not be an issue if I can solve the original question about deleting all remnants of the Services page. But I'm not sure.

FIREBUG SCREENSHOT
User generated image
GOOD PRODUCTS PAGE
User generated image
BAD SERVICES PAGE
User generated image
GOOD CONTACT PAGE
User generated image
ASKER CERTIFIED SOLUTION
Avatar of Peter Hart
Peter Hart
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jerry L

ASKER

REPLY
I modified the link to /services1/ and that fixes it. Searching the files on my hard drive (I unzipped a backup done by BackupBuddy), the word "services" appears in BackupBuddy files and in several sql tables. There is a page-services.php file mentioned in the options table of the database. It is for a so-called, "Template Name: Service page with contact form", so that looks suspicious - see code snippet below...

QUESTION
Is there a way to make it so I can use the permalink with /services/ in it? What do you suggest to get us a little closer?

NOTE
I sent you an EE internal message with the link in it.

<?php
/*
*	Template Name: Service page with contact form
*/
 get_header(); the_post(); ?>
<div id="content" class="service-page">
	<div class="container">
		<div class="banner">
			<?php echo get_the_post_thumbnail($post->ID, 'full'); ?>
		</div>
		<div class="content-page">
			<h2 class="title-content"><?php the_title(); ?></h2>
			<div class="text-content"><?php the_content(); ?></div>
		</div>
		<div class="contact-form">
			<?php echo do_shortcode(rs::getField('ctf_shortcode',$post->ID, 'text')); ?>
		</div>
		<div class="clear"></div>`
	</div>
</div><!-- id content-->
<?php get_footer(); ?>

Open in new window

Hello WizeOwl,
have you deleted the page from the trash as well?
Sometimes in older installs, the trashed page still has some impact until you empty it from the trash as well. When you look at your list of pages in the admin, you'll see the Trash link along with the others at the top left. You should empty the trash of any pages that are languishing in there.
Avatar of Jerry L

ASKER

Shown below is the "page source" (right click > show page source) for both versions of the rendered Services page in the browser.

QUESTION
Can someone help me figure out how to modify the Wordpress code to create a conditional statement in the LOOP that will eliminate these errors? Thanks!

ALSO, at some point, the file, "page-services.php", gets executed. Thus, there is probably a conditional "if" statement somewhere. I'll look for that.

The first difference is LINE 80:
This text shows in the /services/ permalink, but not in the /services-2/ permalink:
<span class="attribute-name">class</span>="<a class="attribute-value">service1-page</a>"

The next differences appear at LINES 100, 102, and 103
Note, in line 100, the class attribute for the Contact Form, <a class="attribute-value">contact-form</a>

SERVICES1 PAGE (Permalink: /services1/) << RENDERING CORRECTLY

<span id="line80"></span></span><span>&lt;/<span class="end-tag">div</span>&gt;</span><span></span><span class="comment">&lt;!-- id header--&gt;</span><span></span><span>&lt;<span class="start-tag">div</span> <span class="attribute-name">id</span>="<a class="attribute-value">content</a>"&gt;</span><span>
>>> snip <<<
<span id="line99"></span></span><span>&lt;/<span class="end-tag">div</span>&gt;</span><span>
<span id="line100"></span></span><span>&lt;/<span class="end-tag">div</span>&gt;</span><span>
<span id="line101"></span></span><span>&lt;/<span class="end-tag">div</span>&gt;</span><span></span><span class="comment">&lt;!-- id content--&gt;</span><span>

SERVICES PAGE: (Permalink: /services/) << RENDERING INCORRECTLY

<span id="line80"></span></span><span>&lt;/<span class="end-tag">div</span>&gt;</span><span></span><span class="comment">&lt;!-- id header--&gt;</span><span></span><span>&lt;<span class="start-tag">div</span> <span class="attribute-name">id</span>="<a class="attribute-value">content</a>"<span class="attribute-name">class</span>="<a class="attribute-value">service1-page</a>"&gt;</span><span>
>>> snip <<<
<span id="line99"></span></span><span>&lt;/<span class="end-tag">div</span>&gt;</span><span>
<span id="line100"></span></span><span>&lt;<span class="start-tag">div</span><span class="attribute-name">class</span>="<a class="attribute-value">contact-form</a>"&gt;</span><span>
<span id="line101"></span></span><span>&lt;/<span class="end-tag">div</span>&gt;</span><span>
<span id="line102"></span></span><span>&lt;<span class="start-tag">div</span> <span class="attribute-name">class</span>="<a class="attribute-value">clear</a>"&gt;</span><span></span><span>&lt;/<span class="end-tag">div</span>&gt;</span><span>`
<span id="line103"></span></span><span>&lt;/<span class="end-tag">div</span>&gt;</span><span>
<span id="line104"></span></span><span>&lt;/<span class="end-tag">div</span>&gt;</span><span></span><span class="comment">&lt;!-- id content--&gt;</span><span>
Avatar of Jerry L

ASKER

FIXED IT
chilternPC got me headed in the right direction.
Added conditional test code for "Services" page in the page-services.php file.

		<?php if ( ! is_page('services') ) { ?>
			<div class="contact-form">
				<?php echo do_shortcode(rs::getField('ctf_shortcode',$post->ID, 'text')); ?>
			</div>
		<?php } ?>

Open in new window