I'm trying to do something that should be very straightforward, but after trying to figure it out with the current documentation for the past 2 hours, I am still baffled as to how to do it.
I have a custom post type called "Lodges". I am successfully displaying the post content with for each Lodge with an Elementor Template. Now I need to be able to allow logged in users to edit the post contents (those which they are an author of).
I've created a Post Form, and set its "Form type" to "Edit existing content" and "Post type to create/edit" = "Lodges".
Because it's not explained anywhere, the best I could come up with is to create a View that I can display on a page and pass a URL parameter to; the url parameter would be the title of the post that that is authored by the current logged in user (which i can look up). So I can build a link to a URL like this: mydomain.com/edit-lodge/?title=mylodge. Then in the view I can display the form that I built, which presumably would display the field contents for the "current" lodeg in the view.
But in the view, there is no way to filter lodges by post title. I can find no way to control which "Lodge" post is displayed in a view.
Or is there an altogether better way to accomplish what I'm trying to do (display a form for editing the post content which they have authored)?
UPDATE: I've figured out that I can query the view with a URL parameter and query based on a field called "site-post-title", which I'm assuming means it's the post title. I've set "Select items with field: site-post-title is a string equal to URL_PARAM(lodgename)".
When I go to the page which has the View with the URL parameter ?lodgename=Aylmer+Lake+Lodge, it shows "No items found.". There is a Lodge with the name "Aylmer Lake Lodge".
So the query is not working. I'm still not sure if this is the right way to do this, but if so, why doesn't it work?
As I understand, you have already build a view that lists the post belongs to the author who is logged in user. If this is true:
- The method you shared to find the post by the title is not the correct way to go.
If you can share the problem URL where you listed the author posts using the view and access details I can check and try to help you further. Please share the following information.
- Did you add the Edit form link to your view?
- Where you want to display the edit post form to edit the Lodges posts?
- What Edit form I should use to integrate the Edit functionality for you.
I managed to find that there are settings for displaying different fields on a post's edit screen. The author field was hidden by default (why??!) so I unhid it, which allows me to set the author field, and query the view by author. This will work.