antonop4u
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: Block editor Doesn’t appear for custom post typeYes that’s was the problem, thank you very much now it works perfectly!!!
Forum: Plugins
In reply to: [Translate Wordpress with GTranslate] Selected Language Using PHPVery usefull tlanks!
Forum: Developing with WordPress
In reply to: wp_localize_script does not workThanks, Now it works.
Forum: Developing with WordPress
In reply to: wp_localize_script does not workNow the problem is that the ajax call returns with status code 200 ok, but it returns the page I called the ajax call from.
I’ve been using this functions for a while now and it always work, now it simply doesn’t.
this is on the server side:
add_action( 'wp_ajax_ar_ajax_click_count', 'ar_ajax_click_count' );
add_action( 'wp_ajax_nopriv_ar_ajax_click_count', 'ar_ajax_click_count' );
function ar_ajax_click_count(){
if ( wp_verify_nonce( $_POST['_wpnonce'], 'wp_rest' ) ){
if ( preg_match( '/^(\d){1,10}$/' , $_POST['id'] ) ) {
// if (!current_user_can('administrator')) {
count_clicks( $_POST['id'] );
// }
echo json_encode(
array(
'sts' => $_POST['id']
)
);
exit;
} else {
exit;
}
} else {
exit;
}
}This is on the javascript side:
function javascripCountCliks(id){
jQuery(document).ready( function($) {
$.ajax( {
method : 'POST',
dataType : 'json',
url : ar_var.ajaxurl,
data : {
id : id,
_wpnonce : ar_var.nonce,
action : 'ar_ajax_click_count' },
beforeSend : function( xhr ){
}
} )
.done(
function( data ){
console.log(data);
}
);
} );
}any Idea?
Forum: Developing with WordPress
In reply to: wp_localize_script does not workyes this way works I get the vaiables I need Thanks
Forum: Developing with WordPress
In reply to: wp_localize_script does not workI tried ar_home_js, it doen’t work still the same problem. thanks anyway.
I’m not sure what happened but the problem now is solved I hope. the galleries have started showing, I did nothing.
May be is the cache the update itself. Not sure.
Forum: Developing with WordPress
In reply to: wp_kses_post custom html tagsbcworkz Thanks.
Regarding the custom tags, I’ve notice (I actually read it some where but i honestly don’t remember where) that if you set<custtag>something</custtag>the browser I used so far (crome, edge,opera,firefox…) have no problem recognizing them as html tags. Even in Javascriptelement.tagName = 'CUSTTAG'.
I’m not sure if it’s SEO problem. I normally use them in the the back end not visible to the search engines.Forum: Developing with WordPress
In reply to: No privilege ajax not working after WordPress updateIf I’m the only one with this problem it must be something on my code/server/setting… I also agree it must be a coincidence that this is happening after the update.
Thanks anywayForum: Developing with WordPress
In reply to: No privilege ajax not working after WordPress updateyes through the function:
wp_localize_script( 'my_general_functions_js', 'my_var', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'wp_rest' ) ) );I also tried to echo something different in the else just at string:
echo json_encode( array( 'foo' => 'foo' ) );but it still gives me an error 400;
If I checked the response in the network section of the developer tool it just shows a 0, I presume it’s a false;
The strange thing is that until the update everything was fine, it actually it is still fine for the logged in user. The logged in user ajax call work perfectly.Forum: Developing with WordPress
In reply to: Composer HTTP_Proxy problemthanks
Forum: Developing with WordPress
In reply to: COMPRESS and UNCOMPRESS data for the databaseOk, Thanks for the warning.
Forum: Developing with WordPress
In reply to: Custom page for a specific page returns the archive pageProblem solved.
In case someone will have a similar problem, It was my mistake, I gave to the two pages the exact same slug of two custom post types names.
I changed the slugs and now everything is fine.I’ve seen in the official documentation that ‘macbookandrew’ also use the
$wpdb::preparemethod on theSELECTqueries, is there any particular reason to it?ok thank you very much