[wp-trac] [WordPress Trac] #27674: WP_Query auto-draft
WordPress Trac
noreply at wordpress.org
Sun Apr 6 16:50:54 UTC 2014
#27674: WP_Query auto-draft
-------------------------------+------------------------------
Reporter: Philo01 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version: 3.8.1
Severity: normal | Resolution:
Keywords: reporter-feedback | Focuses:
-------------------------------+------------------------------
Comment (by Philo01):
I'm allowing users to create a new property on the front-end side, so in
order to attach images etc, I'm using the same approach as the back-end,
by creating an auto-draft. If they submit the form, but it didn't pass the
validation they are returned and the original values are loaded via the
property id.
{{{
<?php
if($property_id = $input->get('property-id')) // $_GET
{
$property = new WP_Query( 'p=' . $property_id .
'&post_type=property&post_status=auto-draft' );
}
else
{
$property = get_default_post_to_edit( 'property', true );
}
<form action="<?php echo add_query_arg(array('property-id' =>
$property->ID), get_permalink()); ?>" method="post">
}}}
When I try to access an existing property via ?property-id=123 it won't
work. It results in 0 rows, if I run the generated MySQL query against the
database it does return 1 row. Could you try and see if you can reproduce
the problem with the code above? Thanks
--
Ticket URL: <https://core.trac.wordpress.org/ticket/27674#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list