Questions tagged [id]

A unique identifier.

Filter by
Sorted by
Tagged with
0
votes
2answers
855 views

Generate unique number when registering a new user

I know there are userID, username in the database, but I want a formatted and unique number for physical world use. For example: "2014xxxx" 201414:year,xxxx:generate randomly when registering a user. ...
1
vote
4answers
18k views

get menu id using its name

I have a menu name Social Network. I want to get the menus ID. I tried the following, but didn't succeed. global $wpdb; $menu_slug = 'social-network'; $menu_id = $wpdb->get_results( " ...
2
votes
2answers
1k views

Undefined variable post_id in custom quick edit coloumn

I am trying to add a custom coloumn to post quick edit and everything is almost working. Custom meta is saved and passed but if I click on quick edit the preview is blank. This is the error it gives ...
0
votes
0answers
11 views

Set a numeric range for post ID generation based on post type?

I'm wondering if there's any way to configure WordPress to assign post IDs like so: Pages ID range: 10000 to 19999 Posts ID range: 20000 to 29999 Custom post type 'A' ID range: 30000 - 39999 Custom ...
40
votes
6answers
101k views

how to get page id of a page using page slug

Im pretty new to wordpress and I was wondering if I could get a page id with it's slug. Is it possible please let me know.
0
votes
2answers
612 views

Is it possible to have dynamic post id # in add_menu_page()?

I use the add_menu_page function in my custom theme builds but when I export my local copy of the site and import it in the production site some of post id numbers change and I have to update this ...
0
votes
0answers
22 views

Trying to get post ID outside loop on blog page

I have a blog index page which only lists 1 custom post at a time on the index page (it is paginated). I am trying to get the ID of that post from outside the loop (in the footer, after the loop) but ...
1
vote
1answer
18 views

How to get category URL with the slug?

I have a variable that contains the slug of a category. With that slug I want to create a link to the archive page that displays all the posts in that specific category. What is the best or fastest ...
0
votes
0answers
18 views

Is it possible to add the product id, to each item, in the cart table with WooCommerce?

I have my cart page working fine, but I need each item to have a class with its id or category (because I need to add some css only to certain products). Is this possible? Thank you.
0
votes
2answers
4k views

How to get widget content in Wordpress based on it's ID?

I need to parse widget content based on it's ID. But a widget works like a function that pulls data based on it's arguments, right? So when I pull the widget data, I can only get it's arguments, not ...
11
votes
3answers
33k views

How do I get the current edit page ID in the admin?

Most solutions I found are for front-end use. This is for a plugin, so the all activity is in the back-end. How do I get the page ID that's being currently use(edited) in the admin? Note I'm out of ...
1
vote
0answers
19 views

How to get the upcoming post ID from front end?

Searching with "Next Post ID" is giving me the Previous/Next Post Navigation, but my question is not related to that. In WordPress Admin panel, when we're attempting to create a new post the post is ...
0
votes
1answer
48 views

How to get an array of pages ID by some page's slug and all its children pages in get_posts() function?

I have a custom function in my theme that creates a dynamic sitemap.xml file. For that I'm using $myVar = get_posts( array(...) ). In that array I need to exclude some pages. I want to exclude some ...
0
votes
2answers
2k views

Edit tag_id in category pages of dashboard

When we create a category, WordPress randomly assigns a tag_id for that category. Is it possible to change that ID in the category section? For example I create a category X and it is assigned ...
1
vote
0answers
21 views

How to get the post ID's of the five most recent posts [duplicate]

How can I get an array with the post ID's of the five most recent posts? I need it to exclude those posts from a WP_Query / get_posts(). I need a WP_query that skips the first five posts and starts ...
0
votes
3answers
3k views

How to get post ID with hooks publish_post, new_to_publish, etc

I have two plugins, one uses the function wp_insert_post(), the other has a code like this: add_action('future_to_publish', 'myFunc', 10, 1); add_action('new_to_publish', 'myFunc', 10, 1); add_action(...
2
votes
2answers
6k views

get author comment id by comment id

I need to get author ID by comment ID Example functionName($commentID){ return $authorID; }
0
votes
1answer
23 views

How to I know the class or ID of my theme?

I'd like to know the class or ID of the theme menu I'm using. Is there a way to find this value?
0
votes
0answers
16 views

Reuse old post ID for new post after deleting post

I want to Reuse old post ID for new post after deleting some post. I have a site that has Q&A and I displayed the post ID before the title of each question so that the user / I can guess how many ...
0
votes
0answers
49 views

How to use current post ID in pods single value widget?

How can I get the current post slug (or ID) to view a simple pods field in a widget? I really can't find a way to do it. In the single field pods widget there are 4 fields: Title (I can leave it ...
13
votes
2answers
71k views

How to get page title with the page ID?

My page ID is: 30601 How can get the title of this ID? I want get page's title with ID.
4
votes
5answers
25k views

Get the current post ID as a variable in Javascript

I'm trying to echo the post ID in a post Javascript and not having any luck. var post_id = '123'; // works fine var post_id = '<?php global $post; echo $post->ID; ?>'; // echos 'ID; ?>'...
0
votes
0answers
229 views

Trying to get property 'ID' and 'post_author' of non-object error

time. Last week I updated to version 7.0 of php and from there it is giving me the following errors: Notice: Trying to get property 'ID' of non-object in web_URL/wp-content/themes/stellenportal/tool-...
0
votes
1answer
10 views

How to only get the content of post page while looping?

so I am working with wordpress and I created a calendar with events (custom post_type). I have a page which shows the calendar with all the event dates from this post_type which works fine. Now I want ...
0
votes
0answers
38 views

get_current_user_id() always return 0 in if else statement

I'm trying to get logged in user id after if else statement but always return 0. When i put get_current_user_id() before it gives correct user id. How can I make it work in if statement? <?php ...
0
votes
3answers
3k views

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

I would like the create a link that point to the comment part. So when reader click on my link, it will scroll down to the place that they can leave a reply. I have read some tutorial which teach ...
0
votes
0answers
28 views

How to get the url of the entry in which an image belongs

I'm creating a custom attachment template in WordPress, so far so good, but I would like to show the url of the entries or articles where that image belongs somehow? <div class="entry-attachment"&...
0
votes
1answer
45 views

Append USER ID to an outbound link?

Please bear with me as I am a newbie. Is there a way to append a USER ID aka a logged-in user's ID to any external link. For example, a logged-in user clicks a link, the link then appends that user'...
1
vote
2answers
4k views

Does an article (post) id ever change?

So I'm working on a plugin for wordpress, and a novice at it as well. I need to use the ID of a wordpress post, or blog article rather, as a unique reference id, or lets say in database terms, a ...
18
votes
8answers
57k views

How to get Author ID outside the loop

I can't get the post author ID outside the loop to make the get_the_author_meta work. So far I've tried different approaches: 1. $author_id=$post->post_author; 2. global $post; $author_id=$post-...
0
votes
1answer
25 views

Get Current Post ID in WP Loop For GiveWP

How to get current ID for WP Loop in my case? I try to loop the GIVEWP (Success), then I try to echo shortcode of GOAL Progress Bar of GiveWP but the problem is, i don't know how to get the current ...
1
vote
1answer
32 views

Get ALL post ID's export list (Only id's. Php or sql not important )

please help me. I dont know How can I do. I need list all posts IDs. export need 1 3 5 6 7 8 9 . . . . Please help
1
vote
2answers
3k views

Get widget Title from widget id

Is there anyway at all to get the title of a widget from the widget id? The post title can be used by using get_the_title() Is there a way to get the title for a widget using the same kind or ...
0
votes
1answer
6k views

Getting post id from wp_insert_post_data function?

I'm trying to use the function get_the_tags() from outside the 'loop'. I understand this can be achieved by using the post ID like get_the_tags($postID). Does anyone know how I can get the post ID ...
0
votes
3answers
497 views

get_all_category_ids for bookmark

I was wondering how to create a list of categories name and ids for Wordpress Bookmarks such as get_all_category_ids for post. I tried using the get_bookmarks, but the category does not appear in it. ...
12
votes
2answers
9k views

Get page IDs from nav items

I am trying to get all the IDs in my navigation and convert it to a string so that I can use it with wp_query to get the pages that are only listed in the nav. The code to get the IDs: $menu_name = '...
0
votes
1answer
184 views

Get post attachment with post id

I have a form where user can upload a file, which creates a post with an attachment. I would like to get this attachment with post id, because this is the only thing I have in my case. Is it possible ?...
1
vote
0answers
75 views

Is there an equivalent of the PHP function sanitize_key in Gutenberg?

In WordPress's PHP library there is a function sanitize_key used to generate database keys and HTML IDs. I'd like to generate a slug from a title that can be used as an HTML ID, from within a ...
0
votes
0answers
38 views

Pass post ID to wp_update_post

Need your help. I have created a custom post type and have a list table of the latest 10 posts. I need to change the post status of those post which I check a checkbox. However, I can not figure out ...
0
votes
0answers
13 views

Consequence of the post auto incrementer off?

I'm moving a site with specific post IDs. If I programatically make a post with postID "4", and the autoincrementer is at "3", what are the consequences? Would it just skip to "5", overwrite 4, or ...
0
votes
0answers
108 views

WooCommerce: add product description in Composite Products component

I'm currently trying to show the product description inside the components of the Composite Products plugin. The Javascript option_id already throws out the right id-number at the right spot when ...
0
votes
2answers
432 views

Get page content by ID (from a plugin)

I'm stuck on loading page content by id (through a plugin). What I have is the following: <?php $my_query = new WP_Query('page_id=39'); ?> <?php while ($my_query->have_posts()) : $...
3
votes
3answers
1k views

Is post ID number always incremental n+

I have one question. Will WordPress always assign new post post ID which is incremental n+? For example if I delete some posts, will WordPress use ID of deleted post for new post added in future?
0
votes
0answers
33 views

Safely changing UserID's, re-using deleted UserID's and automatically using deleted userID's instead of an increment

I'm looking for 3 different solutions all relating to user ids, I'm needing a solution to safely make changes without destroying the site. Issue 1: I am wanting to change the userID of a user from ...
0
votes
1answer
24 views

create new users in db starting at what ID?

I have to create several hundred users using mysql. How do I know which user IDs to give them? I don't want to duplicate already-in-use IDs, so is there a way to check which IDs are safe to use for ...
2
votes
4answers
201 views

Getting the wrong page ID

I am developing a theme and I need to get the actual page ID, when I do: global $post; $thePostID = $post->ID; I get the wrong ID. I tried get_the_ID() and I get the same ID that in the code ...
1
vote
4answers
619 views

get_users(…) only returns one user

I have an array of user IDs, I want to get data for each of these users. I first thought of writing a classic SQL query but I found WordPress has integreted functions for it. However, get_users(...) ...
0
votes
1answer
787 views

retrieve permalinks of posts inside custom post type by using post ID

I have these custom post types registered as shown in the image below - In each of these custom post types, there are many posts. I have the function to retrieve the post IDs of each posts inside but ...
1
vote
2answers
24 views

Always Encounter Using ID in Wordpress as a Final Solution [closed]

I am learning Wordpress Development. I am noticing whenever I encountered a problem I usually check the web for similar issue(s) for the solution. Anyway, what I want to ask is, I've noticed, most ...
1
vote
1answer
141 views

Query Post Object in WP Admin

How can I fetch the details of the $post object of the very post that I'm working on in WP admin? I've tried global $post but I believe that $post is not available during editing. A little context: ...

1
2 3 4 5 6