PHP - How do I get `<?php the_content(); ?>` as a string or turn it into a string

PHP - How do I get `<?php the_content(); ?>` as a string or turn it into a string

php reference manual
how to use php manual
web php
php echo
download php manual
php 5.6 reference
php _get
php php

I use a lot the function:


To get the value returned from searches and to be able to modify and use the string.

I need to know a function to get <?php the_content(); ?> as a string or how to turn what that function returns into a string.

The content is just a simple word with paragraph tags but using that function I also get the tags, I want to get just the text so I can add it to a hyperlink.

I think you're looking for get_the_content(), which is well documented:

PHP and HTML - Manual, How do I get all the results from a select multiple HTML tag? How can I pass a variable from Javascript to PHP? What encoding/decoding do I need when I pass a  The PHP $_REQUEST variable can be used to get the result from form data sent with both the GET and POST methods. Try out following example by putting the source code in test.php script.

If you need to store it in a variable with html formatting do this


Manual, <?php echo 'Hello ' . htmlspecialchars($_GET["name"]) . '!'; ?> Assuming the user entered The above example will output  Hiding PHP Keeping Current Features HTTP authentication with PHP Cookies Sessions Dealing with XForms Handling file uploads Using remote files Connection handling Persistent Database Connections Safe Mode Command line usage Garbage Collection DTrace Dynamic Tracing Function Reference Affecting PHP's Behaviour Audio Formats Manipulation

Don't know WP, but the implied naming convention would suggest get_the_content(). Additional googling reveals a variation get_the_content_with_formatting

An alternative would be however to wrap the_content() into ob_start() and ob_get_contents()+ob_end(). The latter returns any print output made until then.

PHP $_REQUEST, super global variable which is used to collect data after submitting an HTML form. The example below shows a form with an input field and a submit button. When a user submits the data by clicking on "Submit", the form data is sent to the file specified in the action attribute of the <form> tag. When the user fills out the form above and clicks the submit button, the form data is sent for processing to a PHP file named "welcome.php". The form data is sent with the HTTP POST method. To display the submitted data you could simply echo all the variables.

You should use get_the_content() in order to make get it into a string, which you can format.

What is PHP Tutorial, . PHP is usually used in conjunction with a MySQL database on Linux/UNIX web servers. Teams. Q&A for Work. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information.

$the_post = get_post();

Full list of things you can get using this method:

[ID] =>
    [post_author] =>
    [post_date] => 
    [post_date_gmt] => 
    [post_content] => 
    [post_title] => 
    [post_excerpt] => 
    [post_status] =>
    [comment_status] =>
    [ping_status] => 
    [post_password] => 
    [post_name] =>
    [to_ping] => 
    [pinged] => 
    [post_modified] => 
    [post_modified_gmt] =>
    [post_content_filtered] => 
    [post_parent] => 
    [guid] => 
    [menu_order] =>
    [post_type] =>
    [post_mime_type] => 
    [comment_count] =>
    [filter] =>

Using PHP - Manual, How and why did they get there? How does the PHP directive register_globals affect me? When I do the following, the output is printed in the wrong order: <?​php  To send submitted data through form, one can use GET & POST method to do that in PHP. A form data can be submitted using these two methods. Both are used for same purpose but stands apart under some specifications. As in GET method key values are passed in the Url while in POST, the information transfers in a hidden manner.

Your first PHP-enabled page - Manual, Make sure that you access the file via http with the server providing you the output. If you just call up the file from your file system, then it will not be parsed by​  Before you can use the the $_GET variable you have to have a form in html that has the method equal to GET. Then in the php, you can use the $_GET variable to get the data that you wanted. The $_GET syntax is ($_GET['name of the form field goes here']).

Obtaining PHP - Manual, Where can I obtain PHP? Are pre-compiled binary versions available? Where can I get libraries needed to compile some of the optional PHP extensions? How do I  Dirties up the Source - Data that PHP generates is outputted directly to the HTML source, meaning that you get a bigger and less focused HTML source. Harder to get structured data - Structured data will have to be valid HTML, otherwise you'll have to escape and convert strings yourself.

What do I need? - Manual, If your server supports PHP, then you do not need to do anything. Just create your You may also want to visit » apt-get to find packages for Debian. add a note  PHP has been ported to nearly every operating system and is completely free to use. The official PHP website is There's a whole Documentation section that serves as an online PHP manual if you need help learning more about what you can do with PHP or how it all works. Another good source is W3Schools.