Jump to content

WordPress get_posts/get_pages problem

Judahnator

I have run into a problem with WordPress's get_post and get_page functions. I was wondering if anyone had seen this, or knows of a work-around, or knows what I am doing wrong here.

 

If I use get_posts, it works fine and returns the first 10 or so posts.

If I use get_posts and request a custom post type, it works fine.

If I use get_posts, and request the post type "page" it will echo the pages instead of returning them.

 

I thought that I could solve this problem by simply using the get_pages function. It does the same thing though.

If however, I use get_pages and request a post type other than "page," such as "post," it works fine again.

 

Am I missing something simple? What is going on?

 

If you want to look for yourself, install a JSON viewer on your browser and visit the links below:

http://jeffreymcguire.com/wovaxapi/core/get_posts/?post_type=post

http://jeffreymcguire.com/wovaxapi/core/get_posts/?post_type=page

You will see the difference. The first link returns the content of the posts to the script and it continues fine, the second will echo all the content out instead of returning to my script.

~Judah

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×