Does an article (post) id ever change?

No they don’t change, but you shouldn’t rely on them for external sites. If we’re talking about purely in the database on an individual WordPress site, then: If it’s a published/established post/page then yes, the ID will not change other than to delete it If its a revision, a draft, etc the ID won’t change, … Read more

How can I get the page url slug when ‘post_name’ returns an id?

Try this : $menu = get_term( $locations[$theme_location], ‘nav_menu’ ); $menu_items = wp_get_nav_menu_items($menu->term_id); foreach( $menu_items as $menu_item ) { $link = $menu_item->url; $title = $menu_item->title; $slug = basename($menu_item->url); } Pass the whole permalink to the basename function, which will automatically process the URL and give us only the slug.

Getting post id from wp_insert_post_data function?

In the following, ’10’ is the priority that my_func gets called and ‘2’ is the number of arguments that my_func accepts. The latter is important, since the add_filter function defines the default as 1, but the wp_insert_post_data filter hook sends two arguments. If you don’t set this as 2 you won’t get the second argument. … Read more

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)