Hot answers tagged

2

No no no! Never POST or link directly to a custom PHP file - WordPress won't be loaded, and to load it manually yourself means making huge assumptions about the file hierarchy. Use the ajax API, which exists specifically for this reason: $.ajax({ url: "<?php echo esc_js( admin_url( 'admin-ajax.php' ) ) ?>", type: "POST", data: { ...


2

After Milo's tutorship: I recommend first reading how to use AJAX in Plugins properly. – Milo yesterday and reading another questions on wp.stack, my problem was solved) Here is an examples of code from my rewritten files 1)get_state.php: ad add_action( 'wp_ajax_ajax_object', 'ajax_handler' ); add_action( 'wp_ajax_nopriv_ajax_object', ...


1

Very broad solution. There are two problems you are facing there are different HTML generated by the server based on if there is a featured image Meta box are just a UI artifact of post editing and are not easily manipulated via AJAX (even in AJAX it is easier to handle full objects rather then their individual properties, even if only for keeping ...


1

Try this, with " tags on .= '<a href="'.get_permalink($id).'"><img src="'.$image['url'].'" /></a>';


1

That's called Thickbox. Since you give no clue what you want to use it for, you'll have to figure out the rest for yourself...


1

the_content is usually "executed" in the context of a loop when all relevant global data is set. You should try to mimic it by using code like function get_page_content(){ global $post; $id = $_REQUEST['id']; $post = get_page($id); setup_postdata($post); echo apply_filters('the_content', $post->post_content); //echo ...


1

Why are you making work hard for yourself? wp_create_user already checks if the email/login exists, which is also why your code is "failing" - $user_id will already be a WP_Error, so your elseif ( is_wp_error( $newerrors ) ) never fires. All you need is: $user_id = wp_create_user( $sanitized_user_login, $user_pass, $user_email, $capa ); if ( is_wp_error( ...



Only top voted, non community-wiki answers of a minimum length are eligible