How can I get an array of all IDs from the current queried object?

You are overwriting $post_ids variable on every while loop, never collecting them. That can be solved using $post_ids = array(); while (have_posts()) : the_post(); $post_ids[] = get_the_ID(); endwhile; var_dump($post_ids); // this is an array of ids However there is simpler way, you can skip the whle cycle and simply run: if( function_exists( ‘wpseo_local_show_map’ ) && … Read more

How to create a link to jump to “Leave a comment” part?

The code below should be something similar to what you’re looking for Inside the loop template you use for listing blogs (like index.php) you need something like this <a href=”<?php the_permalink(); ?>/#respond”> <!– The blog permalink with the anchor ID after –> <i class=”fa fa-comments-o”></i> Leave a Comment </a> Inside your comments.php file you could … Read more

get menu id using its name

You can use the function get_term_by and use ‘name’ in the field param. <?php get_term_by( $field, $value, $taxonomy, $output, $filter ) ?> Example: $term = get_term_by(‘name’, ‘Social Network’, ‘nav_menu’); $menu_id = $term->term_id; Here is the link to the codex page: http://codex.wordpress.org/Function_Reference/get_term_by Hope this helps.

Get Post ID with insert/edit link

Not an exact answer to your question (hooking into the insert/edit link functionality), but possibly an alternate method that can achieve the same goal (inputting a permalink, outputting a Post ID): https://codex.wordpress.org/Function_Reference/url_to_postid

How to retrieve the content (with a specific ID) via ajax by clicking a link tag

I would put the action in the post data $.ajax({ url: “/wp-admin/admin-ajax.php”, type:”POST”, data: { action: “my_custom_data”, post_link: post_ID }, success: function (response) { console.log(response); $(‘#post-data’).append(response); } }); return false; ….. Then use $_POST[‘post_link’] in your PHP function my_custom_data(){ $post_link = $_POST[‘post_link’]; echo get_the_content($post_link); die(); }

Getting the wrong page ID

As mentioned in the comments, you are trying to get the ID in the taxonomy archive (template-taxonomy.php) which is not a post object and has no record in the database. It just tries to show some posts and you may get the first post ID when you use get_te_ID() function in that archive page. Using … Read more