Skip to main content
added 11 characters in body
Source Link
nat
  • 101
  • 2

When using Custom Post Types within a plugin, I would like to create a way that on the when editing I could change the use of 'action=' in the url, to something else opening a new url which would focus in on different areas of editing my post. It would allow the user to focus on certain areas of the post they are editing in cleaner viewsview without everything on one page. But still allowing me to tap into the post when saving. In the past I've always used div'sDiv's over the top of everything with higher indexing to hide everything else but having come across this I thought this might look neater.

What I would like to achieve is creating more options for 'action=' within the URL. I've seen it done in plugins like Elementor page builder. As standard it is written in the post.php file to have the options of edit, editattachment, editpost, trash, preview and more. They have built onto it to addin elementor adding elementor, elementor-library and others.

/* Link to look like */
www.example.co.uk/wp-admin/post.php?post=15&action=newaction

My thinking is somehow I need to add to the existing list seen by post.php and then tell it what to display when accessing the URL. In a test to see how this would function I temporarily made a new case within post.php using 'newaction' with the same code as the 'edit' case. I was expecting it to then show the editor when accessing the URL see above, however instead it redirects you to

www.example.co.uk/wp-admin/edit.php

I'm not sure if it would need something else adding like:

if($_POST['action' == 'example1']){
prevent default redirect and load scripts/stylesheets etc for page
} 

or if it's something you have to tell Wordpress to allow somehow.

Has anyone come across this before or would happen to be able to point me in the right direction. I've been through Elementors plugin files to see if I could work it out offfrom that but. But it seems to jump all over the place being such a big plugin its annoying to follow and thought someone may know faster on here.

When using Custom Post Types within a plugin, I would like to create a way that on the when editing I could change the use of 'action=' in the url, to something else opening a new url which would focus in on different areas of editing my post. It would allow the user to focus on certain areas of the post they are editing in cleaner views without everything on one page. But still allowing me to tap into the post when saving. In the past I've always used div's over the top of everything with higher indexing to hide everything else but having come across this I thought this might look neater.

What I would like to achieve is creating more options for 'action=' within the URL. I've seen it done in plugins like Elementor page builder. As standard it is written in the post.php file to have the options of edit, editattachment, editpost, trash, preview and more. They have built it to add elementor, elementor-library and others.

/* Link to look like */
www.example.co.uk/wp-admin/post.php?post=15&action=newaction

My thinking is somehow I need to add to the existing list seen by post.php and then tell it what to display when accessing the URL. In a test to see how this would function I temporarily made a new case within post.php using 'newaction' with the same code as the 'edit' case. I was expecting it to then show the editor when accessing the URL see above, however instead it redirects you to

www.example.co.uk/wp-admin/edit.php

I'm not sure if it would need something else adding like:

if($_POST['action' == 'example1']){
prevent default redirect and load scripts/stylesheets etc for page
} 

or if it's something you have to tell Wordpress to allow somehow.

Has anyone come across this before or would happen to be able to point me in the right direction. I've been through Elementors plugin files to see if I could work it out off that but it seems to jump all over the place being such a big plugin its annoying to follow and thought someone may know faster on here.

When using Custom Post Types within a plugin, I would like to create a way that when editing I could change the use of 'action=' in the url, to something else opening a new url which would focus in on different areas of editing my post. It would allow the user to focus on certain areas of the post they are editing in cleaner view without everything on one page. But still allowing me to tap into the post when saving. In the past I've always used Div's over the top of everything with higher indexing to hide everything else but having come across this I thought this might look neater.

What I would like to achieve is creating more options for 'action=' within the URL. I've seen it done in plugins like Elementor page builder. As standard it is written in the post.php file to have the options of edit, editattachment, editpost, trash, preview and more. They have built onto it in elementor adding elementor, elementor-library and others.

/* Link to look like */
www.example.co.uk/wp-admin/post.php?post=15&action=newaction

My thinking is somehow I need to add to the existing list seen by post.php and then tell it what to display when accessing the URL. In a test to see how this would function I temporarily made a new case within post.php using 'newaction' with the same code as the 'edit' case. I was expecting it to then show the editor when accessing the URL see above, however instead it redirects you to

www.example.co.uk/wp-admin/edit.php

I'm not sure if it would need something else adding like:

if($_POST['action' == 'example1']){
prevent default redirect and load scripts/stylesheets etc for page
} 

or if it's something you have to tell Wordpress to allow somehow.

Has anyone come across this before or would happen to be able to point me in the right direction. I've been through Elementors plugin files to see if I could work it out from that. But it seems to jump all over the place being such a big plugin its annoying to follow and thought someone may know faster on here.

Source Link
nat
  • 101
  • 2

Add to 'action' within post.php to allow more actions when editing a Custom Post Type in a plugin

When using Custom Post Types within a plugin, I would like to create a way that on the when editing I could change the use of 'action=' in the url, to something else opening a new url which would focus in on different areas of editing my post. It would allow the user to focus on certain areas of the post they are editing in cleaner views without everything on one page. But still allowing me to tap into the post when saving. In the past I've always used div's over the top of everything with higher indexing to hide everything else but having come across this I thought this might look neater.

What I would like to achieve is creating more options for 'action=' within the URL. I've seen it done in plugins like Elementor page builder. As standard it is written in the post.php file to have the options of edit, editattachment, editpost, trash, preview and more. They have built it to add elementor, elementor-library and others.

/* Link to look like */
www.example.co.uk/wp-admin/post.php?post=15&action=newaction

My thinking is somehow I need to add to the existing list seen by post.php and then tell it what to display when accessing the URL. In a test to see how this would function I temporarily made a new case within post.php using 'newaction' with the same code as the 'edit' case. I was expecting it to then show the editor when accessing the URL see above, however instead it redirects you to

www.example.co.uk/wp-admin/edit.php

I'm not sure if it would need something else adding like:

if($_POST['action' == 'example1']){
prevent default redirect and load scripts/stylesheets etc for page
} 

or if it's something you have to tell Wordpress to allow somehow.

Has anyone come across this before or would happen to be able to point me in the right direction. I've been through Elementors plugin files to see if I could work it out off that but it seems to jump all over the place being such a big plugin its annoying to follow and thought someone may know faster on here.