Hello,
I am using this function attachment_url_to_postid() and putting the hardcoded url in it for example suppose: I need to run this : attachment_url_to_postid(‘http://localhost/cnp851/sp-content/uploads/2020/12/ck9838-8-adidas-cblack-gresix-silvmt-original-imafebvqa8q8crc5-150×150.jpeg’) it gives me 0 as the attachment id whereas when I put wp-content in the url it gives me a proper attachment id. I tried replacing sp-content with wp-content string in the running time but it always returns sp-content due to which the attachment id is fetched as 0.