Ajax request returning full page code
My issue was simple; jQuery.post(MyAjax.**ajax_url**, data, function(response) { was meant to be: jQuery.post(MyAjax.**ajaxurl**, data, function(response) { problem solved… sorry
My issue was simple; jQuery.post(MyAjax.**ajax_url**, data, function(response) { was meant to be: jQuery.post(MyAjax.**ajaxurl**, data, function(response) { problem solved… sorry
OK, let’s get some thing staight first. Here is list of actions run during typical request. It goes like this: … init … parse_request … parse_query pre_get_posts posts_selection … wp As you can see, posts are selected much later after init. To be more precise, even the request is parsed after init hook. So there … Read more
First of all, you shouldn’t call your own PHP file. You should use admin-ajax endpoint. Documentation On admin side, you could use ajaxurl to get URL for AJAX calls. On front side you have to declare by yourself variable with url. This is written in documentation: Note: Unlike on the admin side, the ajaxurl javascript … Read more
Yes this is possible with WordPress but I would not use index.php but a custom front-page.php template then create a page called home and set it as the front page in options-general. For your category menu: <?php $categories = get_categories(); ?> <ul id=”category-menu”> <?php foreach ( $categories as $cat ) { ?> <li id=”cat-<?php echo … Read more
It’s inlineeditnonce. Check line 1185 of admin-ajax.php for details.
If you use wp_die() you can utilize the tools included with WordPress’s PHPUnit test suite. The WP_Ajax_UnitTestCase provides the _handleAjax() method that will hook into the actions called by wp_die() and throw an exception, which will prevent die() from being called. I’ve written a tutorial on how to use WP_Ajax_UnitTestCase, which explains all of the … Read more
The german (core) developer Dominik Schilling/ocean90 has released a pretty nice, simple and small plugin to encounter (part of) this problem. Instead of adding a complex AJAX save process, that would just make it harder to work with even handlers and such (de- & re-registering them), he just added a position marker, that allows WP … Read more
I’m not a friend of link only answers, but as I can’t bind the whole source code + explanation in here, I’ll just leave a link to @Rarst Fragment Cache Plugin.
My recommendation would be to use a plug-in like Lightbox Plus to power your link. Clicking the link would load your standard login form inside a lightbox. You could then automatically redirect to the same page so that, once logged in, users can leave a comment. Basically, you’d dynamically build your link to be something … Read more
No, it is not needed. If you want to show the data to some users only, you can use current_user_can( ‘some_capability’ ) to restrict the access.