Edit the_content function

I want to edit the default function the_content(). I know i can add_filter(‘the_content’, ‘with_my_function’) but im having trouble outputting the old content with mine. Heres an example of what im doing. add_filter(‘the_content’, ‘my_function’); function my_function() { $write=”hello world”; $content = apply_filters(‘the_content’, get_the_content()); echo $write.$content; } How can i get this to work? 1 Answer 1 … Read more

Forbidden 403 error, permission to access, unable to read htaccess

Recently clean-installed (with exception of themes and content/upload folders) an old wordpress to the latest WordPress 4.2.2. I continue to get this error below whenever I load files such as style.css in the web browser manually. I’ve tried: changing this file’s permission to 644, 755, and 777 changing .c to .so in the .htaccess changing … Read more

JSON not valid after json_encode posts

I’m having problems saving JSON in a custom table in my database. I pull some posts (+ connected posts) from the database and add them to an array. This is a part of my array: array(2) { [“post”]=> array(22) { [“post_author”]=> string(1) “1” [“post_date”]=> string(19) “2015-07-30 13:36:23” [“post_date_gmt”]=> string(19) “2015-07-30 13:36:23” [“post_content”]=> string(1002) “[:en]Integer posuere … Read more

Have multiple local wordpress installs share a wp-content folder and database

On my local machine, I have multiple wordpress versions installed so I can test the themes and plugins I develop. I was wondering if I could somehow create a central wp-content folder and database, which are linked to each version of wordpress, so I don’t have to continually copy my projects between the them? 2 … Read more

What is the best / efficient way to get WordPress content by post id and why?

I just wanted to get WordPress content by post id. I found the following three ways to get WordPress content by post id. (All the following ways I found on this site.) Method 01: $content_post = get_post($my_postid); $content = $content_post->post_content; $content = apply_filters(‘the_content’, $content); $content = str_replace(‘]]>’, ‘]]>’, $content); Method 02: $content=get_post_field(‘post_content’, $my_postid); Method 03: … Read more