Angie
Angie

Reputation: 899

Warning: require_once(): http:// wrapper is disabled

Let me clarify. I was told the following:

Using include_once 'http://domain.com/website/?p=154';

The warning is generated because I am using a full URL for the file that I am including. This is NOT the right way because this way I am going to get some HTML from the webserver.

Instead I should use:

require_once('../web/page-name.php');

so that webserver could EXECUTE the script and deliver its output, instead of just serving up the source code (my current case which leads to the warning).

When creating a page in Wordpress, it provides a shortlink and a permalink but does not give an actual page-name.php (at least not that I’m aware of).

shortlink: http:// domain.com/website/?p=154

permalink: http:// domain.com/website/index.php/listing/

So my question is, is there a way to use an include to include the above page or not. If not, simply say no rather than be condescending about it, because if I knew the answer, I wouldn’t be posting on this site, would I?

Upvotes: 0

Views: 621

Answers (1)

Angie
Angie

Reputation: 899

Never mind I just found the answer. Took me a total of 5 hours to figure this out. I guess I should have held off on posting the question here a little longer.

The answer:

<?php
$include = get_pages('include=154');
$content = apply_filters('the_content',$include[0]->post_content);
echo $content;
?>

Upvotes: 1

Related Questions