I'm currently looking for a way to change / hide the default WordPress admin-ajax.php URL. I want to do this to remove the admin from it to prevent misunderstandings by my customers when I use the AJAX URL to read for example a file from my server. In this case, the URL has the admin prefix which is a bit confusing.
So in result the AJAX URl should looks like this: ajax.php
I've searched a bit but I can't find any helpful information. Because of this I can't show you any related code. But when I got it, I'll update my question to help other people.
Alternatively and perhaps more effectively you could leverage WP API and create a custom endpoint to process your data so that there isn't url confusion.
Related
I am trying to achieve a customized url that shows in url header. Different for every WordPress post.
For example, I have posts in WordPress about different countries what I want is that when I click on a country the single post page which normally shows up like this in the browser url field:
www.example.com/2017/11/china
Should show up like this, only in header like.
china.example.com or
russia.example.com
I don't know if I can achieve this using WordPress or Do I have to play around with .htaccess file.
There are more than 200 posts and I am trying to find a way to do it using an automated script or WordPress code.
I want this link to be associated with the actual post on the WordPress site. Please let me know if it's achievable or if there is already a post on stack overflow that solves this. I couldn't find one. Thank you.
china.example.com is a subdomain, example.com/.../china is a folder. They are actually two different things. To achieve this effect though, you would need to set up a multi-site wordpress installation, and treat china.example.com as one website and russia.example.com as another
Let's say I publish a page in WordPress and it generates a url like this.
mydomain.com/pagestructure
I need to have this structure
mydomain.com/page/structure
I figured several ways of doing that.
Edit url from the page edit screen
Edit permalink structure and use Custom structure there
Edit .htaccess
I can't use the second method because I need this structure only for a single, particular page. Not for all pages.
I can't use third method as it is a bit difficult for me. Sorry for that.
The first method is I want to use as it is the most simpler one. But I am not able to use it because WP does not allow putting "/" at desired places. It re-writes them. If by somehow I prevent the re-writing of "/", maybe via adding a rewrite rule via "add_rewrite_rule", it might solve the problem. Any help?
I've found a number of plugins for wordpress that add a link to the table in the backend to clone or duplicate a post or page (Duplicate Post, Clone Post, and Post Duplicator). This is nice, but I'm building a bit of an app on wordpress where I'm using a custom post type as an entry and would like to be able to quickly copy an entry with a link from the frontend of the site (similar to how edit_post_link works but without jumping into the backend).
I'm using Gravity Forms for the create and edit functionality for entries on the frontend, but I can't quite figure out the best approach for a secure way to submit a request, execute the clone query, and the return to the same page I was on before (i.e. not jumping into the backend). Gravity Forms Post Updates plugin does something similar with a do_action call to generate a link. I've looked through this function and generally get what's happening, but I'm not sure if I need all of the extra plugin class structure.
I was hoping to find an example of a function that could create a secure url with a nonce and then another function we validate the url and execute the query and return to the previous page. Is this the right way to go or am I barking up the wrong tree? If so, any code samples or examples that might be able to help get me started?
Much appreciated!
I found this post (http://rudrastyh.com/wordpress/duplicate-post.html) and was able to figure out what I needed to. Instead of adding a filter to include the link in the backend, I instead created an action that can be called with do_action and generates the link. I also have a page and page template that is solely for executing the call and then redirecting back to the referring url.
I got to get some points for this question cause I can't find a good answer anywhere :P Or atleast I don't know the proper terminology for doing this type of post.
Anyhow I want my magento application to dynamically make a post to a external server. I know Magento has some libraries that allow you to dynamically add values and create a post from the controller or model layer. I just can't find any good resources to do so. Could someone provide or show me a good example on how to set some values and submit a post to the external server ?
In a nutshell I want the user to make a post to my server, I evaluate the data, and if the criteria's are met, I will redirect that data in a post to another server.
I also want to utilize the magento Form libraries to do so, I don't know which libraries give me access to do this.
Take a look # Varien_Http_Adapter_Curl
See
Using CURL Functions in magento
I am building a website for sharing links and pictures for php experience. Currently, each post has a page where users can comment on it. Every post also has an id that is stored in a database with it. What would be the easiest way to make this id the url of the post? For example:
For the question that has an id of 4a3cd5, I would want the url for that question to be post.com/posts.php/4a3cd5. thanks for your answers.
In the HTAccess page (.htaccess), write the following code:-
Options +FollowSymLinks
RewriteBase /
RewriteRule ^posts/(.*)/$ /posts.php?id=$1
So now, in the Address Space, if you write http://localhost/posts/4a3cd5, the user will be shown a page corresponding to the post ID of 4a3cd5. Internally, the URL which will get processed is this one http://localhost/posts.php?id=4a3cd5. This whole technique is being done by HTAccess, and this way of showing URLs to users is called SEF URLs.
More on the HTAccess tips & tricks can be found here.
Now in the page "posts.php", you can write all the logic which you want using the PHP GET Superglobal Array "$_GET['id']".
NP: A special note - please try to avoid this type of coding. Instead try using any of the available standard PHP MVC Frameworks.
That would involve a lot, maybe you should just have URL's like /posts.php/?post=4a3cd5.
Overall this would be much more practical. You can just GET the post variable and connect to your SQL database.